I might be wrong but it seems that the soft keyboard can only be controled from the activity that first used it.
This is how I got it to work:
In the same Activity:
This is how I got it to work:
B4X:
Sub Globals
Private EditText1 As EditText
Dim IME1 As IME
End Sub
Sub Activity_Create(FirstTime As Boolean)
Activity.LoadLayout("3")
Activity.Title = "XNotes - " & Main.curfile
EditText1.Text = Main.text
IME1.Initialize("IME")
DoEvents
IME1.ShowKeyboard(EditText1)
End Sub
In the same Activity:
B4X:
Sub Button2_Click
Dim rc As Int
If EditText1.Text <> Main.text Then
rc = Msgbox2("Do you want to SAVE?","Changes Made","Yes","","No",Null)
If rc = DialogResponse.POSITIVE Then
Button1_Click
End If
End If
IME1.HideKeyboard
Activity.Finish
End Sub