Android Question Email keyboard won't hide

Rusty

Well-Known Member
Licensed User
I have used:
B4X:
Sub btnSendEmail_Click
    Dim email As Email
    email.To.Add(Starter.emailAddress)
    email.Subject = "User Report"
    email.body = "this is the body"
    Dim in As Intent = email.GetIntent
    StartActivity(in)   
End Sub
When the email is created, the soft keyboard does not go away.
In the Activity_Resume, it have:

B4X:
Sub HideKeyboard
    Dim phone1 As Phone
    phone1.HideKeyboard(Activity)
End Sub

Sub Activity_Resume
    CallSub(Me, "HideKeyboard")
End Sub

Sub Activity_Pause (UserClosed As Boolean)
    CallSubDelayed(Me, "HideKeyboard")
End Sub
I found this solution HERE offered by Erel. However, this was in 2012 and I fear things have changed.
Is there a solution to hide the keyboard upon return from the Email intent?
Thanks
Rusty
 

Computersmith64

Well-Known Member
Licensed User
I have used:
B4X:
Sub btnSendEmail_Click
    Dim email As Email
    email.To.Add(Starter.emailAddress)
    email.Subject = "User Report"
    email.body = "this is the body"
    Dim in As Intent = email.GetIntent
    StartActivity(in) 
End Sub
When the email is created, the soft keyboard does not go away.
In the Activity_Resume, it have:

B4X:
Sub HideKeyboard
    Dim phone1 As Phone
    phone1.HideKeyboard(Activity)
End Sub

Sub Activity_Resume
    CallSub(Me, "HideKeyboard")
End Sub

Sub Activity_Pause (UserClosed As Boolean)
    CallSubDelayed(Me, "HideKeyboard")
End Sub
I found this solution HERE offered by Erel. However, this was in 2012 and I fear things have changed.
Is there a solution to hide the keyboard upon return from the Email intent?
Thanks
Rusty
Try this - although I find that they keyboard always auto-hides after the email intent closes, so I never use the code below for that (although I do use it in other instances where I have shown the keyboard):

B4X:
Sub Activity_Resume
    Hidekeyboard
End Sub

Sub Activity_Pause(UserClosed as Boolean)
    Hidekeyboard
End Sub

Private Sub HideKeyboard
    Private ime as IME

    ime.Initialize("")
    Sleep(50)
    ime.HideKeyboard
End Sub
- Colin.
 
Top