android - How to avoid selecting last item from autocompletetextview -
i creating simple application having autocompletetextview
contains names. want load imageview
@ end of last item of autocompletetextview should non clickable/selectable.
i able populate list along displaying imageview
after last list item however, cant make non clickable/selectable. means, everytime selects empty field autocompletetextview
& sets blank/empty.
here, getview()
method code:
@override public view getview(int position, view convertview, viewgroup parent) { view view; layoutinflater inflater = (layoutinflater) mcontext.getsystemservice(context.layout_inflater_service); if (position != (resultlist.size() - 1)) view = inflater.inflate(r.layout.autocomplete_list_item, null); else view = inflater.inflate(r.layout.autocomplete_google_logo, null); if (position != (resultlist.size() - 1)) { textview autocompletetextview = (textview) view.findviewbyid(r.id.autocompletetext); autocompletetextview.settext(resultlist.get(position).getcitydescription()); } else { relativelayout imageview = (relativelayout) view.findviewbyid(r.id.rltop); imageview.setclickable(false); imageview.setenabled(false); } return view; }
got solution.
thanks @selvin comment.
@override public boolean isenabled(int position) { if (position != resultlist.size() - 1) return true; else return false; } @override public view getview(int position, view convertview, viewgroup parent) { view view; layoutinflater inflater = (layoutinflater) mcontext.getsystemservice(context.layout_inflater_service); if (position != (resultlist.size() - 1)) view = inflater.inflate(r.layout.autocomplete_list_item, null); else view = inflater.inflate(r.layout.autocomplete_logo, null); if (position != (resultlist.size() - 1)) { textview autocompletetextview = (textview) view.findviewbyid(r.id.autocompletetext); autocompletetextview.settext(resultlist.get(position).getname()); } else { relativelayout imageview = (relativelayout) view.findviewbyid(r.id.rltop); } return view; }
Comments
Post a Comment