Android Tutorial [java] BA.raiseEventFromUI

Discussion in 'Libraries developers questions' started by Erel, May 21, 2012.

  1. Erel

    Erel Administrator Staff Member Licensed 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).
     
  2. Informatix

    Informatix Expert Licensed User

    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 ?
     
  3. Erel

    Erel Administrator Staff Member Licensed User

    You can use RaiseEvent instead of RaiseEventFromUI. The only limitation is that you shouldn't show a modal dialog or call DoEvents from the event sub.
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice