android - Need help to spot null pointer exception java -


when compile android device gives me null pointer exception. have been trying find null pointer exception is, without luck. have activity button , edittext. when click button text in edittext should end item in listview. please help.

log: http://i61.tinypic.com/14lq33n.jpg

source:

package com.example.foodplannerbeta;  import java.util.arraylist; import android.app.activity; import android.content.pm.activityinfo; import android.os.bundle; import android.view.menu; import android.view.menuitem; import android.view.view; import android.view.window; import android.widget.arrayadapter; import android.widget.button; import android.widget.edittext; import android.widget.listview;  public class indkob2activity extends activity {  private button bt; private listview lv; private arraylist<string> al; private arrayadapter<string> adapter; private edittext et;  @override protected void oncreate(bundle savedinstancestate) {     super.oncreate(savedinstancestate);     setrequestedorientation(activityinfo.screen_orientation_portrait);     this.requestwindowfeature(window.feature_no_title);     setcontentview(r.layout.activity_indkob2);      bt = (button) findviewbyid(r.id.btncustomindkob);     lv = (listview) findviewbyid(r.id.listview1);     et = (edittext) findviewbyid(r.id.customedittrec);     al = new arraylist<string>();      adapter = new arrayadapter<string>(this, android.r.layout.simple_list_item_1, al);     lv.setadapter(adapter);     bt.setonclicklistener(new view.onclicklistener() {          public void onclick(view arg0) {             al.add(et.gettext().tostring());             adapter.notifydatasetchanged();         }     });      } } 

the npe seems on bt.setonclicklistener() call. is, bt null.

make sure activity_indkob2 layout in fact contains view id btncustomindkob.


Comments

Popular posts from this blog

javascript - how to protect a flash video from refresh? -

visual studio 2010 - Connect to informix database windows form application -

android - Associate same looper with different threads -