Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Done is not working in softKeyboard in Autocomplete TextView in android

Tags:

android

I have One AutocompleTextView and I want to make the virtual keyboard disappear when he hits "DONE" at the AutocompleTextView. So far, the buttons "NEXT"/"DONE" do nothing at all. Any ideas?

like image 393
Pinki Avatar asked Jun 24 '10 11:06

Pinki


3 Answers

Add this Property to your AutoCompleteTextView in xml:

android:imeOptions="actionDone"
like image 51
fasttrack Avatar answered Oct 02 '22 03:10

fasttrack


The following works for all the Views which support imeOptions; for instance EditText, TextView, AutocompleteTextView, etc.

In your xml:

<autocompleteTextView

inputType = "text"
imeOptions = "actionDone"
/>

In Java:

autocomplete = (AutoCompleteTextView) issueDetailView.findViewById(R.id.yourId);
autocomplete.setOnEditorActionListener(new TextView.OnEditorActionListener() {
            @Override
            public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
               if(actionId== EditorInfo.IME_ACTION_DONE) {
                  //do Whatever you Want to do
               }
                return true;
            }
        });
like image 25
Rahul Jain Avatar answered Oct 02 '22 03:10

Rahul Jain


Just add the following on yours XML layout file:

  android:imeOptions="actionDone"
  android:singleLine="true"
like image 21
Frank021 Avatar answered Oct 02 '22 03:10

Frank021