Hey pabbot,
I'm facing the same problem you had, but, sorry, i didn't
understand your solution. Could you explain better? thanks a lot
Breno
On 15 out, 05:03, pabbot <[EMAIL PROTECTED]> wrote:
> Ok. It's solved.
>
> The solution is not only to detect the KEYCODE_ENTER but also the key
> down. Previously it detected both the key press and the key release
> and this fired two KEYCODE_ENTER events...
>
> On 14 oct, 23:50, pabbot <[EMAIL PROTECTED]> wrote:
>
> > 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
-~----------~----~----~----~------~----~------~--~---