How to catch the โ€œnextโ€ button on an Android soft keyboard

I have 6 Edittexts grouped into 6 different layouts, all in one view. My problem is that my application is forced to enter landscape mode, and by clicking the "Next" button, I want to automatically start editing another editText, and not the one that is installed by default for Android. Example: I write on EditText1, click on next, and the focus is taken using EditText, which is under the first. I want to edit the one that is CORRECT to it.

Sorry for my poor English :( The device is a galaxy tab with Google API8 / Android 2.2 Thanks

+4
source share
2 answers

Not tested, but it should work

some_edittext.setOnEditorActionListener(new OnEditorActionListener() { public boolean onEditorAction(TextView v, int actionId, KeyEvent event) { if (actionId == EditorInfo.IME_ACTION_NEXT) { some_button.performClick(); return true; } return false; } }); 
+18
source

Maybe I'm wrong, but I don't think there is any implicit way to do this. You will need to write your own EditorAction .

You need to keep track of everything the user enters, and whenever he presses "NEXT" , you will have to manually switch the focus to the next EditText using EditorInfo.IME_ACTION_NEXT .

0
source

All Articles