I am getting java.lang.NullPointerException for this method. I have check the adapter and lists are just fine and the list is ofcourse under fragment_phonelist xml file.
private void showCustomDialog() {
final Dialog dialog = new Dialog(SetupProfile.this);
dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
dialog.setContentView(R.layout.fragment_phonelist);
Button done = (Button)dialog.findViewById(R.id.btn_done);
Button canCel = (Button)dialog.findViewById(R.id.btn_cancel);
ListView PhoneListView = (ListView)findViewById(R.id.list_phone);
MyCustomAdapter tst = new MyCustomAdapter(this,ContactName,ContactNumb);
PhoneListView.setAdapter(tst);
done.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
dialog.dismiss();
}
});
canCel.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
dialog.dismiss();
}
});
dialog.show();
}
Please any help..
This line
ListView PhoneListView = (ListView)findViewById(R.id.list_phone);
Shouldn't that be like this:
ListView PhoneListView = (ListView)dialog.findViewById(R.id.list_phone);