NullPointerException when using AutoCompleteTextView android -


the exception

09-09 23:55:25.336: e/androidruntime(14983): java.lang.nullpointerexception 09-09 23:55:25.336: e/androidruntime(14983):    @ android.widget.arrayadapter.createviewfromresource(arrayadapter.java:353) 09-09 23:55:25.336: e/androidruntime(14983):    @ android.widget.arrayadapter.getview(arrayadapter.java:323) 09-09 23:55:25.336: e/androidruntime(14983):    @ android.widget.abslistview.obtainview(abslistview.java:1430) 09-09 23:55:25.336: e/androidruntime(14983):    @ android.widget.autocompletetextview$dropdownlistview.obtainview(autocompletetextview.java:1656) 09-09 23:55:25.336: e/androidruntime(14983):    @ android.widget.listview.measureheightofchildren(listview.java:1264) 

the code

    fromautocomplete = new autocomplete(             this, // r.layout.fromautocomplete,             android.r.layout.simple_list_item_single_choice,             r.id.fromautocomplete);     fromautocomplete.setnotifyonchange(true);     fromaddress = (autocompletetextview) findviewbyid(r.id.fromaddress);     fromaddress.setadapter(fromautocomplete);     fromaddress.setonitemclicklistener(this);     fromaddress.setonfocuschangelistener(this);     fromaddress.setonclicklistener(this);     toautocomplete = new autocomplete(this,             android.r.layout.simple_list_item_single_choice,             // r.layout.toautocomplete,             r.id.toautocomplete);     toautocomplete.setnotifyonchange(true);     toaddress = (autocompletetextview) findviewbyid(r.id.toaddress);     toaddress.setadapter(toautocomplete);     toaddress.setonitemclicklistener(this);     toaddress.setonfocuschangelistener(this);     toaddress.setonclicklistener(this); 

the autocomplete (some relevant lines of code)

public class autocomplete extends arrayadapter<string> implements filterable {  public autocomplete(activity activity, int layout, int textviewresourceid) {     super(activity, layout, textviewresourceid);     //super(activity, textviewresourceid);   } 

results

  1. toaddress works fine,
  2. fromaddress crash's

obviously autocomplete thing, not crashing in code, in inflation

edit : fixed issue by

    toautocomplete = new autocomplete(this,                     r.layout.toautocomplete,         r.id.toautocomplete);     fromautocomplete = new autocomplete(             this, r.layout.fromautocomplete,             r.id.fromautocomplete); 

edit : fixed issue by

toautocomplete = new autocomplete(this,                 r.layout.toautocomplete,     r.id.toautocomplete); fromautocomplete = new autocomplete(         this, r.layout.fromautocomplete,         r.id.fromautocomplete); 

Comments

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

jsf - How to ajax update an item in the footer of a PrimeFaces dataTable? -

jquery - Keeping Kendo Datepicker in min/max range -