Android Question [SOLVED] IME_HeightChanged event : What's missing?

Brian Dean

Well-Known Member
Licensed User
Longtime User
Here us my complete project code ...

B4X:
Sub Process_Globals

End Sub

Sub Globals
    Dim test As EditText
    Dim IME As IME
End Sub

Sub Activity_Create(FirstTime As Boolean)
    IME.Initialize("IME")
    test.Initialize("test")
    test.Color = Colors.DarkGray
    test.TextSize = 20
    Activity.AddView(test, 0, 25%Y, 100%X, 48dip) 
End Sub

Sub Activity_Resume
  
End Sub

Sub Activity_Pause (UserClosed As Boolean)

End Sub

Private Sub IME_HeightChanged (NewHeight As Int, OldHeight As Int)
    Log("IME_HeightChanged") 
End Sub

My manifest is the default manifest (B4A Version 9.5; sdk level 26) plus the following line ...

B4X:
SetActivityAttribute(main, android:windowSoftInputMode, adjustResize|stateHidden)

What could be simpler? But when I run the project and enter text the keyboard appears but the IME_HeightChanged event does not fire. Why not?
 
Last edited:

JohnC

Expert
Licensed User
Longtime User
You need to add this line in the Activity_Create:
B4X:
IME.AddHeightChangedEvent
 
Upvote 0
Top