Bytecode
Bytecode

Reputation: 6591

Android Virtual KeyboardListener

I have an EditText which when some text entered the virtual keyboard appears and when I press enter I can't get focus in my second EditText, but some times it works.

Anybody please help.

edittext.setOnKeyListener(new OnKeyListener() {

    public boolean onKey(View v, int keyCode, KeyEvent event) {

        if (keyCode == KeyEvent.KEYCODE_ENTER)// key code for virtual keyboard next
            {
                System.out.println("Event catched>>>>>>>>>>>>>>");

                edittext.requestFocus();

            }

            return false;
        }
    });

Upvotes: 2

Views: 1234

Answers (2)

Rodolfo Faquin
Rodolfo Faquin

Reputation: 830

Used android:imeOptions="flagNavigateNext" on the Edittext

Upvotes: 2

Macarse
Macarse

Reputation: 93123

You shouldn't do that from your code.

You need to setup the android:imeOptions correctly in your EditText.

Upvotes: 1

Related Questions