I have a ListView subclass that display rows that each contain an EditText and a TextView.
When I touch the EditText it’s gaining focus (good), the user type the information I want, and type the KEYCODE_ENTER to launch the onEditorAction() method from the OnEditorActionListener interface. On that method I’m dismissing the keyboard with this
InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
imm.hideSoftInputFromWindow(et.getWindowToken(), 0);
All other EditText updates accordingly to the input change.
(all good so far).
BUT
After all that the orange focus is passed up to the next focus (the following row).
I would want to remove this behaviour in this case, but still want the user to have the ability to navigate from one to an other using up and down key.
So my question is:
How and where can I remove the focus of an EditText that is in a row of a ListView?
Note that:
I’ve try using aView.clearFocus(); in the onEditorAction() on the EditText that is giving the focus to the next one. (don’t work)
I’ve try using thatListView.clearFocus();, but as expected it didn’t worked.
and if there is no easy way I’m planning to go row by row and child by child to do a v.clearFocus().
Thanks
In your
onEditorAction(), returntrueto tell that you have consumed the action.