android - How to add Search functionality on list view items in listview are from BaseAdapter -
i have add search functionality on edittext items in listview coming baseadapter using code .getfilter().filter(s.tostring()); not coming
my code :-
approvedfriendlist.setadapter(new approvedlist()); //*********search functionality in approved friend list************************ serch_item.addtextchangedlistener(new textwatcher() { @override public void ontextchanged(charsequence s, int start, int before, int count) { // todo auto-generated method stub // approvedfriendlist.getfiltertoucheswhenobscured().f } @override public void beforetextchanged(charsequence s, int start, int count, int after) { // todo auto-generated method stub } @override public void aftertextchanged(editable s) { // todo auto-generated method stub } }); approvedfriendlist arraylist
i not getting how use here .getfilter().filter(s.tostring()); approvedlist()(base adapter class ) need urgent please me
first should enable list view filtering adding line of code :
list.settextfilterenabled(true);
then add text watcher in text view :
text.addtextchangedlistener(new textwatcher() { @override public void ontextchanged(charsequence s, int start, int before, int count) { adapter.getfilter().filter( s.tostring()); list.setadapter(adapter); } @override public void beforetextchanged(charsequence s, int start, int count, int after) { } @override public void aftertextchanged(editable prefix) { } });
Comments
Post a Comment