Android Question Multiple EditTexts and NEXT and DONE key

John C

New Member
Licensed User
Longtime User
I'm working on ny first app and am new to the Android environment and B2A.

One activity consists of 6 EditText controls to be filled in by the user. They are all identical and set to accept DECIMAL_NUMBERS. I am not using IME. (Yet?)

The text fields are laid out on 2 panels, with 3 fields arranged horizontally on each. The 2 panels are arranged vertically, so the layout is:

Panel1: 1 2 3
Panel2: 4 5 6

The user would logically fill them in in order.

My problem is that if I select field one and key a few numbers, the 'NEXT' key is displayed. Hitting that causes focus to change to field 2 with 'NEXT' still displayed. This is what I want. Entering data into field 2 causes 'NEXT' and focus moves to 3. Filling EditText 3 still shows 'NEXT' and it moves down to field 4. This is what I want.

But when I enter anything in box 4, the 'DONE' key is shown and the keyboard closes. I want it to stay at 'NEXT' for all of the fields until the last (#6). I'd understand the logic if it changed to 'DONE' on box 3, I guess, but why #4?

There seems to be no way to force 'NEXT' and keep the keyboard open.

What causes this behavior? Is my only solution to use IME and handle this myself? I have tried putting all EditTexts on a single panel in the same arrangement with the same results.

I've searched the forum and see numerous references to 'NEXT/DONE' issues but still could use some direction.

Thank you!
 

John C

New Member
Licensed User
Longtime User
You can force a NEXT button with this code:
B4X:
Dim jo As JavaObject = EditText1
jo.RunMethod("setImeOptions", Array As Object(5)) '5 = EditorInfo.IME_ACTION_NEXT

Using the Accessibility library you can call SetNextFocusDown to set the next view that will be focused.

This looks like a solution. Thank you.
 
Upvote 0
Top