Android Question IME works in Debug, not in Release

Discussion in 'Android Questions' started by RMarra, Jul 28, 2019.

  1. RMarra

    RMarra Member Licensed User

    I am trying to have the keyboard pop up automatically on a textbox. Here is my code:

    Sub Activity_Create(FirstTime As Boolean)
    Activity.LoadLayout("Calculator")
    Units.Text = ""
    If Glucose.RequestFocus Then
    Dim Keybd As IME
    Keybd.Initialize("IME")
    Keybd.ShowKeyboard(Glucose)​
    End If
    End Sub

    This works perfectly in Debug mode but the keyboard does not appear in Release mode.
     
  2. Erel

    Erel Administrator Staff Member Licensed User

    Please use [code]code here...[/code] tags when posting code.

    The correct way to start an activity with the keyboard opened is by adding this to the manifest editor:
    Code:
    SetActivityAttribute(YourActivity, android:windowSoftInputMode, adjustResize|stateVisible)
    adjustResize or adjustPan based on your requirements.
     
  3. RMarra

    RMarra Member Licensed User

    Thank you! That did it. Sorry about the tags around the code. I was not aware.
     
    Erel likes this.
  4. RMarra

    RMarra Member Licensed User

    I still cannot get the keyboard to open when a specific view gets focus.
     
  5. Erel

    Erel Administrator Staff Member Licensed User

    Add a log message and check whether View.RequestFocus actually returns True.

    Adding Sleep(100) before setting the focus might help.
     
  6. RMarra

    RMarra Member Licensed User

    I think I just need to change my approach. What I'm trying to accomplish is making a required field. If the user presses "DONE" without keying a number, the view does not lose focus, but the keyboard closes. That's why I'm trying to force the keyboard to reappear. This is probably easy to do, but I'm not seeing it.
     
  7. Erel

    Erel Administrator Staff Member Licensed User

    This thread is a good example of how not to ask a question...

    There is a way to do it however you should start a new thread and post the problem you are trying to solve in the first post.
     
    Shelby and DonManfred like this.
  8. RMarra

    RMarra Member Licensed User

    My apology. In my mind, this is all the same question. Apparently I don't understand the protocol for asking questions. In the future, I'll just try to figure things out on my own until I get frustrated and give up on B4A.
     
  9. Erel

    Erel Administrator Staff Member Licensed User

    I tried to guess three times which problem you are trying to solve. This means that the question or problem, which should always appear in the first post didn't include enough information for us to help you.

    Anyway you should take a look in IME.AddHandleActionEvent.
     
  10. RMarra

    RMarra Member Licensed User

    I'm sorry. You are right. I actually found another post about IME.AddHandleActionEvent and it is working nicely, in both debug and release.
     
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