Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to catch 'next' button on soft keyboard of Android

I have 6 Edittexts grouped in 6 differents layouts, all in the same view. My problem is that my app is forced to landscape mode, and by pressing the 'next' button i want to automatically start to edit another editText rather than the one android set me by default. Example: i'm writing on EditText1, press next, and focus is taken by the EditText that is UNDER the 1st one. I want to edit the one that is RIGHT to it.

Sorry for my bad english :( The device is a galaxy tab, with Google API8/Android 2.2 Thanks

like image 258
JJonDuty Avatar asked Feb 04 '13 15:02

JJonDuty


1 Answers

Haven't tested it, but this 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;
        }
    });
like image 71
Mus Avatar answered Oct 15 '22 19:10

Mus