Does an Android class exist with similarities to both Spinner and AutoCompleteTextView? -
i trying take autocompletetextview
and, through onlistitemclicklistener
, return id database. more specific, want user able type in, click on 1 of options pops up, , then, rather completing typed word, click returns id associated word user.
i know that, through custom adapter, can return id through spinner
, want user able type in they're looking for. there way through autocompletetextview
, or class exist can this?
thank you!
afik there no such class both functionalities.
you can try following code that...
final autocompletetextview mautocompletetextview; final arrayadapter<string> madapter = new arrayadapter<string>( getactivity(), android.r.layout.simple_dropdown_item_1line, getresources().getstringarray(r.array.items)); mautocompletetextview = (autocompletetextview) view.findviewbyid(r.id.name_txt); mautocompletetextview.setadapter(madapter); mautocompletetextview.setonclicklistener(new view.onclicklistener() { @override public void onclick(final view arg0) { mautocompletetextview.showdropdown(); } });
Comments
Post a Comment