Selecting an item in AutocompleteTextview should load a list in android? -
i have 1 autocompletetextview, loading string array in it.. can search data typing firstletter .now need load list on selecting each item in autocomplete textview .. how possble?
this autocompletetextview
autocomplete = (autocompletetextview) customview.findviewbyid(r.id.myautocomplete); arrayadapter<string> adapter = new arrayadapter<string>(mainactivity.this, android.r.layout.simple_dropdown_item_1line, enton_web); autocomplete.setadapter(adapter);
thanks in advance
string s1="xcv"; string s2; string [] search=new string[20];<---- search list /** called when activity first created. */ @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.main); ac=(edittext)findviewbyid(r.id.edittext1); listview lv=(listview)findviewbyid(r.id.listview1); //ac.setthreshold(3); //l.add("pp"); s2=ac.gettext().tostring(); adapter=new arrayadapter<string>(this, android.r.layout.simple_list_item_1, l); //adapter.add("pp"); lv.setadapter(adapter); lv.setonitemclicklistener(mmessageclickedhandler); new thread(new runnable() { public void run() { while(infra){ s2=ac.gettext().tostring(); if(s1!=s2 && s2.length()>=1){ s1=s2; for(int=0;i<20;i++) { int index=search[i].index(s1); if(index >-1) { lst.add(search[i])<----- lst arraylist of strings should create } } } } runonuithread(new runnable() { public void run() { adapter.clear(); for(int z=0;z<k;z++){ adapter.add(s[z]); } adapter.notifydatasetchanged(); } }); } } }}).start(); } private onitemclicklistener mmessageclickedhandler = new onitemclicklistener() { public void onitemclick(adapterview<?> parent, view v, int position, long id){ infra=false; string s=d[position]; finish(); intent k=new intent(infrapagesactivity.this,infrapagesactivity.class); startactivity(k); intent i=new intent(this,nextactivity.class); i.putextra("hash",s); startactivity(i); } }; }
next activity
public class nextactivity extends listactivity{ public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); type = getintent().getextras().get("hash").tostring();....
you can search using string "type" , populate list...
Comments
Post a Comment