Android keyboard Next button on textfield focus

27 views
Skip to first unread message

Dante vd merwe

unread,
Nov 11, 2015, 8:03:14 AM11/11/15
to CodenameOne Discussions
Hi, 

I have a container which has several components on it. 

Lets say I have a text field with focus and I push the Next button on the text field, I then have a custom component with 2 buttons and a text field, and I want the text field on the custom component to take focus upon pushing next on the previous component instead of saying "Done" on the keyboard.

How can I achieve this?

Regards.
Dante 

Diamond

unread,
Nov 11, 2015, 2:20:32 PM11/11/15
to CodenameOne Discussions
Let's say you have TextFieldA and TextFieldB, and TextFieldA comes before TextFieldB 

In Gui Builder:

Set NextFocusDown on the TextFieldA to your TextFieldA and NextFocusUp on TextFieldB to TextFieldA.

In code:

              TextField TextFieldA = new TextField();
        TextField TextFieldB = new TextField();
        TextFieldA.setNextFocusDown(TextFieldB);
        TextFieldB.setNextFocusUp(TextFieldA);

Reply all
Reply to author
Forward
0 new messages