i need filtering work. listview displayed correctly, when enter letter in search field gives error
java.lang.nullpointerexception and application closes.
here code snippet activity think have fix, don't know how:
protected void onpostexecute(string file_url) { // dismiss dialog after getting albums pdialog.dismiss(); // updating ui background thread runonuithread(new runnable() { public void run() { /** * updating parsed json data listview * */ listadapter adapter = new simpleadapter( winesearchactivity_2.this, albumslist, r.layout.activity_search_list_of_wines, new string[] { tag_wine_id, tag_wine_name, tag_wine_country_id, tag_wine_country_flag_pic }, new int[] { r.id.wine_id, r.id.wine_name, r.id.wine_country_id, r.id.imageview2 }); listview lv = getlistview(); layoutinflater inflater = getlayoutinflater(); view header = inflater.inflate(r.layout.header, (viewgroup) findviewbyid(r.id.linearlayoutheader)); view search_box = inflater.inflate(r.layout.search_box, (viewgroup) findviewbyid(r.id.relativelayoutsearchbox)); lv.addheaderview(header, null, false); lv.addheaderview(search_box, null, false); // updating listview setlistadapter(adapter); inputsearch = (edittext) findviewbyid(r.id.inputsearch); inputsearch.addtextchangedlistener(new textwatcher() { @override public void ontextchanged(charsequence cs, int arg1, int arg2, int arg3) { // when user changed text ((simpleadapter)winesearchactivity_2.this.adapter).getfilter().filter(cs); } @override public void beforetextchanged(charsequence arg0, int arg1, int arg2, int arg3) { // todo auto-generated method stub } @override public void aftertextchanged(editable arg0) { // todo auto-generated method stub } });
set listadapter adapter globally. sure , work. kamal
Comments
Post a Comment