//A workaround for the Android app “hang” issue with Delphi 10.2.2 Tokyo

A workaround for the Android app “hang” issue with Delphi 10.2.2 Tokyo

The recent Delphi 10.2.2 Tokyo release has resulted in a flurry of reports for apps on Android that “hang” when using tab transitions, or when using “wait” animations. This article offers an explanation for the issue, as well as a potential workaround.

Update: As per E. Spelt’s suggestion on the report, I’ve modified the TThreadedTimer class to call Synchronize, rather than Queue.

TL;DR answer: You can find the workaround at the Kastri Free project.

There were a number of changes in Delphi 10.2.2. Tokyo for Android, including an endeavour to resolve UI performance issue, and part of the changes included how timers are implemented on Android. Because of the change, when any “tight” loops are introduced such as with tab transitions or “wait” animations (e.g. when using TAnimator.AnimateFloatWait), the timer events are never fired because the Android timer code runs on the same thread.

In my investigations into the issue, I discovered that it appears there may be no way to “force” the timer(s) to check if the interval has expired and therefore fire the event, so I’ve created a workaround that “shoe-horns” a thread-based timer into the animations code. Being thread-based, when Application.ProcessMessages is called, CheckSynchronize is ultimately called, and the event that the thread-based timer has queued, is called.

As per the TL;DR answer above, I have posted the workaround in the Kastri Free project. As per the warning in the readme, any workarounds posted should be treated with caution. So far, this one is working for me.

Wishing everyone a Merry Christmas, Happy Hanukkah, Malkh, Yule, Newtonmas, Festivus 😉 or whatever you celebrate at this time of year 🙂

By |2017-12-27T08:29:54+00:00December 23, 2017 10:40 am|Uncategorized|4 Comments

About the Author:


  1. Jhonny Suarez December 26, 2017 at 8:40 am - Reply

    Thank you very much Dave

  2. Wal February 11, 2018 at 7:40 am - Reply

    Excellent! Thank you

  3. China White April 24, 2018 at 9:03 pm - Reply

    Any idea as to why labels lose their style if they have a rectangle as parent when using this fix? I mean after I implement the fix, the tab I’m transitioning to has a few labels on top of rectangles and those labels lose their custom font size, color etc. Thanks.

    • Dave May 4, 2018 at 5:43 pm - Reply

      I am not sure as to why that might happen, however the hang issue has been fixed in 10.2.3, and I strongly recommend updgrading to that

Leave a Reply

Show Buttons
Hide Buttons