AutocompleteTextView: on "NEXT" highlight next TextView, on "DONE", make keyboard disappear AutocompleteTextView: on "NEXT" highlight next TextView, on "DONE", make keyboard disappear android android

AutocompleteTextView: on "NEXT" highlight next TextView, on "DONE", make keyboard disappear


I ran into this problem and fixed it by setting the imeOptions on the AutocompleteTextView to actionNext.

Example:

<AutoCompleteTextView    android:id="@+id/dialog_product_name"    android:layout_width="0dp"    android:layout_height="wrap_content"    android:layout_weight="1"    android:singleLine="true"    android:completionThreshold="1"    android:imeOptions="actionNext"    />


I found this solution for the "NEXT" problem: in your View source code write something like this

@Overridepublic boolean onKeyUp(int keyCode, KeyEvent event) {if (keyCode == KeyEvent.KEYCODE_ENTER) {    if (firstAutoComplete.hasFocus()) {    // sends focus to another field (user pressed "Next")    otherText.requestFocus();    return true;    }    else if (secondAutoComplete.hasFocus()) {            // sends focus to another field (user pressed "Next")    anotherText.requestFocus();    return true;    }}return false;}

It seems to be an old Android http://code.google.com/p/android/issues/detail?id=4208.Here I found my solution: http://groups.google.com/group/android-developers/browse_thread/thread/e53e40bfe255ecaf.


Just add these two lines into AutoCompleteTextView xml Code:

            android:completionThreshold="1"            android:imeOptions="actionNext"