Tuesday 15 June 2010

Android - In-line autocomplete with EditText -



Android - In-line autocomplete with EditText -

i want in-line autocomplete edittext, not result list best suggestion straight in edittext. : in-line auto-complete (near bottom of page).

is possible in android ? give thanks you.

i have no eclipse seek give hints.

to create custom autocomplete this.

first

in view layout add together edittext , outputtext (this visibility=hidden)

second

in activity create textwatcher , implement method aftertextchanged.

inside method phone call service input text , update content of outputtext.

something like:

aftertextchanged(editable s){ // know input edittext final edittext input= (edittext) s; // todo create phone call async string suggestedtext= someservice.getsuggestion(input.getstring()); outputtext.settext(suggestedtext); outputtext.setvisibility(view.visible); // avoid infinite loops if(suggestedtext!=null && !"".equals(suggestedtext) && !suggestedtext.equals(input.getstring()) { // add together onclick command update input outputtext.setonclicklistener(new view.onclicklistener(){ edittext.settext(suggestedtext); }); } } third

implement suggestion service.

android autocomplete search-engine

No comments:

Post a Comment