android - Getting java.lang.NullPointerException on customDialogBox -


i getting java.lang.nullpointerexception method. have check adapter , lists fine , list 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 help..

this line

listview phonelistview = (listview)findviewbyid(r.id.list_phone);  

shouldn't this:

listview phonelistview = (listview)dialog.findviewbyid(r.id.list_phone);  

Comments

Popular posts from this blog

angularjs - ADAL JS Angular- WebAPI add a new role claim to the token -

php - CakePHP HttpSockets send array of paramms -

node.js - Using Node without global install -