Android Question IME soft keyboard and focus order.

stu14t

Active Member
Licensed User
Longtime User
My application has details where a number of edittexts are used to gather information. On start-up, for the first time, all edittexts are filled with information. However, when data is gathered for the next input some general information remains the same (some edittexts retain information) and some specifics change (some of the edittexts are blanked out for refilling). I can set the focus to the correct edittext on return but after that the focus seems random. I'm using the IME soft keyboard and when enter is pressed it often goes to a random edittext and not necessarily the next in order.

Is there a way of stopping the focus change after pressing enter?
 
Last edited:

DonManfred

Expert
Licensed User
Longtime User
On focuslost you can set the focus to the object which you think is the best "next one".
If the Tag is not used you can set the Object of next edit to the tag.

Dim ....
[..]
edit1.tag = edit2
edit2.tag = edit3
[...]

You then can use ONE focus_change sub for all edits..

B4X:
Sub EditText1_FocusChanged (HasFocus As Boolean)
    Dim s, target As EditText
    s=Sender
    target.Initialize
    target = s.Tag
    target.RequestFocus = True
End Sub

Please note: This sub is written "out of the head" :))) and it is not tested... But it must be something like that i think...
 
Last edited:
Upvote 0

stu14t

Active Member
Licensed User
Longtime User
Thanks for the replies.

I'm going to have to use the accessibility library as i'm already using the tag to hold the background information of the edittexts

Erel, I found the help page via your link but I can't find the library or any tutorial. Is this part of the core?

Sorry, just found it already within the IDE
 
Last edited:
Upvote 0
Top