Android Tutorial [java] BA.raiseEventFromUI

Erel

B4X founder
Staff member
Licensed User
Longtime User
The message queue implementation in Android 4.0.3 was modified in a way that requires us, the libraries developers, to update the way we delegate UI events to the user code. The error happens when the user tries to call DoEvents, show any modal dialog or pause the debugger inside the event.

Starting with B4A v1.92 there is a new method named BA.raiseEventFromUI.
This method posts a message to the message queue. When this message is processed the event will be raised.

Unlike BA.raiseEvent, no value is returned from this method.

It is only required to use this method inside UI events (such as onTouch, onFocusChange and onScrollChanged methods).
 

Informatix

Expert
Licensed User
Longtime User
The message queue implementation in Android 4.0.3 was modified in a way that requires us, the libraries developers, to update the way we delegate UI events to the user code. The error happens when the user tries to call DoEvents, show any modal dialog or pause the debugger inside the event.

Starting with B4A v1.92 there is a new method named BA.raiseEventFromUI.
This method posts a message to the message queue. When this message is processed the event will be raised.

Unlike BA.raiseEvent, no value is returned from this method.

It is only required to use this method inside UI events (such as onTouch, onFocusChange and onScrollChanged methods).

I did that in some of my libraries. But, as a user reported for my Gesture Detector library, there's an annoying performance issue. There's a noticeable lag between the triggering of the event and its reception by the application. Under the emulator, it's unusable and the difference is huge with the same lib using RaiseEvent instead. Reverting to RaiseEvent is not an option currently: it's mandatory, despite the issues with ICS. Can something be fixed here ?
 
Top