Android Question Forcing the virtual keyboard to display the "Done" button.

rleiman

Well-Known Member
Licensed User
Longtime User
Greetings,

In my EditText field from the Designer, I have the "Force Done" property set. The "Done" button is not displayed on the virtual keyboard. Instead, the "Newline" button is displayed. Is there a way using coding to force the "Done" button to be displayed?

Thanks.
Screenshot 2020-10-28 at 21.12.57.pngScreenshot_20201028-211427.jpg
 

drgottjr

Expert
Licensed User
Longtime User
is single line set? if not, "force done" doesn't work. you need a button to get out.
 
Upvote 0

Geezer

Active Member
Licensed User
Longtime User
B4X:
' Configures the Send button
' 1 = Enter, 2 = Checkmark, 3 = Magnify, 4 = Mail, 5 = Next, 6 = DONE
Sub SendButton(et As EditText, SendMode As Int)
    Dim r As Reflector
    r.Target = et
    r.RunMethod2("setImeOptions", SendMode, "java.lang.int")
End Sub
 
Upvote 0

rleiman

Well-Known Member
Licensed User
Longtime User
B4X:
' Configures the Send button
' 1 = Enter, 2 = Checkmark, 3 = Magnify, 4 = Mail, 5 = Next, 6 = DONE
Sub SendButton(et As EditText, SendMode As Int)
    Dim r As Reflector
    r.Target = et
    r.RunMethod2("setImeOptions", SendMode, "java.lang.int")
End Sub
Thanks so much for your coding. I will try it soon and let you know if that works. I file like pulling out my hair just like in your avatar. ?
 
Upvote 0

rleiman

Well-Known Member
Licensed User
Longtime User
B4X:
' Configures the Send button
' 1 = Enter, 2 = Checkmark, 3 = Magnify, 4 = Mail, 5 = Next, 6 = DONE
Sub SendButton(et As EditText, SendMode As Int)
    Dim r As Reflector
    r.Target = et
    r.RunMethod2("setImeOptions", SendMode, "java.lang.int")
End Sub
It only works when I use single line but we need the EditText to be multiline. Do you have any coding that is a work-around?
 
Upvote 0

Jeffrey Cameron

Well-Known Member
Licensed User
Longtime User
I think you will find that anytime you set the EditText to multiline, the OS will do its darndest to have the action button = carriage return.

I suggest you just add a button in the UI near the EditText box for "done entering" or "next field" depending on which you need.
 
Upvote 0
Top