#Region Activity Attributes
#FullScreen: False
#IncludeTitle: True
#End Region
Wait For ime_HeightChanged (NewHeight As Int, OldHeight As Int)
2. The IME is required to handle the change in the activity height that happens after the activity is created. There is an edge case here.
Sub Activity_Create(FirstTime As Boolean)
Dim ime As IME
ime.Initialize("ime")
ime.AddHeightChangedEvent
Dim pm As B4XPagesManager
pm.Initialize(Activity)
CorrectHeight = 100%y
Wait For ime_HeightChanged (NewHeight As Int, OldHeight As Int)
CorrectHeight = NewHeight
LogColor("CorrectHeight " & CorrectHeight, Colors.Blue) ' <----
End Sub
Sub ime_HeightChanged (NewHeight As Int, OldHeight As Int)
LogColor("ime_HeightChanged", Colors.Blue) ' <----
End Sub
Which red square? I don't see it (not even in the source, for now)The question is whether you see the red square? If you see a complete red square then it is fine.
That was why I was wondering about the lineHowever I don't understand why those logs are not executed
Wait For ime_HeightChanged (NewHeight As Int, OldHeight As Int)
It depends on the device behavior. On some devices the activity will start with the correct height and on other devices it will be updated a few milliseconds after the activity was created.However I don't understand why those logs are not executed
There is nothing special here. Wait For can be used to catch events.The Wait For pre-empts the event Sub which is never run, but I still don't understand the mechanism that returns the event Sub parameters as apparently multiple return values. I need to look at the generated Java code.
This is the special bit.There is nothing special here.
I understand the mechanism of Wait For with Resumable Subs. However I had an unknown unknown (© Donald Rumsfeld) in that I didn't understand the mechanism for catching events and returning their multiple parameters as a list of results.Wait For can be used to catch events.
Sub Activity_Create(FirstTime As Boolean)
Dim ime As IME
ime.Initialize("ime")
ime.AddHeightChangedEvent
Dim pm As B4XPagesManager
pm.Initialize(Activity)
CorrectHeight = 100%y
Log("A: " & DateTime.Now)
Wait For ime_HeightChanged (NewHeight As Int, OldHeight As Int)
Log("B: " & DateTime.Now & ", " & NewHeight & ", " & OldHeight)
CorrectHeight = NewHeight
End Sub
Here:and post the logs.
** Activity (activity2) Create, isFirst = true **
A: 1595593292893
** Activity (activity2) Resume **
B: 1595593293103, 1536, 1608