I have two AutocompleTextViews and I want to switch to the next if the user presses "NEXT", and make the virtual keyboard disappear when he hits "DONE" at the second AutocompleTextView. So far, the buttons "NEXT"/"DONE" do nothing at all.... Unfortunately I found no resources addressing this problem.
Any suggestions? thx
EDIT: Just want to add that this was asked when Android was on version 2.3 or something like that.
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
@Override public 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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With