Hello everyone, I tried to use the IME_HeightChanged(NewHeight As Int, OldHeight As Int) event to hide my AdMob banner when the user is typing but I am unable to use this to know if the keyboard was closed back. I need a way to know if the keyboard is opened/closed.
Android IME was handling has always been rubbish, though I think Android 11 or 12 improved things a bit with an imnproved API but that doesn't really help until (if ever) most devices out there are updated. See if GetKeyboardRectangle in my IME2 library does what you want.
I have been having a lot of trouble lately with layouts being corrupted when rotating a device with the soft keyboard open. The problem stems from trying to use the IME library HeightChanged event. Unfortunately Android provides no direct way to determine whether the soft keyboard is shown or...
Hello everyone, I tried to use the IME_HeightChanged(NewHeight As Int, OldHeight As Int) event to hide my AdMob banner when the user is typing but I am unable to use this to know if the keyboard was closed back.
Sub Globals
Private ActivityHeight As Int = 0
End Sub
B4X:
Sub Activity_Create(FirstTime As Boolean)
Activity.LoadLayout("Layout1")
ActivityHeight = Activity.Height
End Sub
B4X:
Sub IME_HeightChanged(NewHeight As Int, OldHeight As Int)
Private IsIMEKeyboardClosed As Boolean = (NewHeight = ActivityHeight)
LogColor("IsIMEKeyboardClosed >> " & IsIMEKeyboardClosed, Colors.Red)
End Sub