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

Discussion in 'Android Questions' started by LuisFP, Feb 12, 2019.

  1. LuisFP

    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
     
  2. Erel

    Erel Administrator Staff Member Licensed User

  3. LuisFP

    LuisFP Member Licensed User

    Thank you for the fast answer.

    This solve my problem. Thanks


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

    Code:
    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
     
  4. Erel

    Erel Administrator Staff Member Licensed User

    Your code is fine. I thought that you are trying to add the EditText control to the list.
     
  5. LuisFP

    LuisFP Member Licensed User

    Perhaps I explained wrong. Thanks

    Great job with b4a :)
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice