Hi everyone,

this is my first post here so I'll try not to extend so much.

I've got a Layout with 3 EditText, called mText1, mText2 and mText3.
I want to navigate through them by pressing the ENTER KEY, so I
decided to set a onKeyListener for every of them and every time I
detect the user presses the ENTER KEY, I set the focus on the next
EditText. But it sets the focus on the "next's next". If I press the
ENTER KEY on mText1, the focus is set on mText3; the same with mText2
(it is set on mText1) and so on...

I can't understand this kind of behaviour.

Any solution? Many thanks in advance.

Here, the code:
mText1.setOnKeyListener(new OnKeyListener() {

                        public boolean onKey(View v, int keyCode, KeyEvent 
event) {
                                if(keyCode == KeyEvent.KEYCODE_ENTER) {
                                        mText2.requestFocus();
                                        return true;
                                }
                                return false;
                        }

        });
mText2.setOnKeyListener(new OnKeyListener() {

                        public boolean onKey(View v, int keyCode, KeyEvent 
event) {
                                if(keyCode == KeyEvent.KEYCODE_ENTER) {
                                        mText3.requestFocus();
                                        return true;
                                }
                                return false;
                        }

        });
mText3.setOnKeyListener(new OnKeyListener() {

                        public boolean onKey(View v, int keyCode, KeyEvent 
event) {
                                if(keyCode == KeyEvent.KEYCODE_ENTER) {
                                        mText1.requestFocus();
                                        return true;
                                }
                                return false;
                        }

        });

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to