Android Question EditText: Done without close Keyboard or Next with focus in the same EditText

LuisFP

Member
Licensed User
I am very noob in b4a. I want to filling a ListView using an EditText. No problem. But I don't want that each time user click on "Done" the keyboard hides since more item should be introduce. Another option is not use 'force Done' and use "Next" which not hide keyboard but then I need to know how can force that "Next" focus on the same EditText since I have several EditText on the LoadLayout.

Tested untill now that not work:

- In Sub EditText1_EnterPressed (with "Done" option): Nothing inside this Sub with this option seem works since with End Sub the keyboard is closed. Then things like these, not work:

EditText1.RequestFocus;
or
Dim ime1 As IME
ime1.ShowKeyboard(EditText1)

- In Sub EditText1_EnterPressed (with "Next" option): I don't know how to indicate that the next view is the same view. Something like that inside this sub don't work

Dim jo As JavaObject = EditText1
jo.RunMethod("setImeOptions", Array As Object(5)) '5 = EditorInfo.IME_ACTION_NEXT
( I am losing something here, sure)

So, How can I use, in EditText, Done without close Keyboard or Next with focus in the same EditText?

Thanks
 

LuisFP

Member
Licensed User
Thank you for the fast answer.

This solve my problem. Thanks

I said:

I want to filling a ListView using an EditText.
You said:

Not possible with ListView. Use xCustomListView.

I don't understand this. I am using the code below (simplifying) and It works for me. Am I missing something?

B4X:
Sub EditText3c_EnterPressed
    Dim etSender As EditText
    etSender=Sender
    If etSender.Text<>"" Then
        ListView3.AddSingleLine(etSender.Text)
        etSender.Text="" 'clean EditText
    End If
End Sub
 

Erel

Administrator
Staff member
Licensed User
Your code is fine. I thought that you are trying to add the EditText control to the list.
 
Top