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

Popular posts from this blog

Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.12:test (default-test) on project.Error occurred in starting fork -

windows - Debug iNetMgr.exe unhandle exception System.Management.Automation.CmdletInvocationException -

configurationsection - activeMq-5.13.3 setup configurations for wildfly 10.0.0 -