Use Bitmaps In Threads On Android With This Fix For Delphi XE5 Firemonkey

Delphi XE5 Firemonkey Android Bitmap ThreadApparently loading a bitmap from a file or a stream from within a thread on Android in Delphi XE5 Firemonkey has a problem. It causes your app to exit completely according to a question and answer on StackOverflow. If you’ve been having problems with bitmaps and threads at all on Android try adding this code fix and see if it takes care of it. The fix involves overriding the EndThreadProc procedure from System.Classes in the OnCreate event of your form. User ioan posted the fix to StackOverflow and Antonio Tortosa from Embarcadero posted the original fix to the Embarcadero forum (see threads here and here). I tested the fix on Android with uImageLoader and it did in fact fix a crash with that class. Override EndThreadProc with the following procedure:

Head over and read the full question and answer about bitmaps and threads with Android on StackOverflow.

Have Delphi Firemonkey questions? Ask and get answers on StackOverflow.

2 Responses to Use Bitmaps In Threads On Android With This Fix For Delphi XE5 Firemonkey

  1. Hey,
    Thanks for re-posting this information. This bug got me at the start of XE5 with TThread and for me a call to TPath in the thread caused Seg11. At the time it took me a day to narrow down TPath was the cause, didnt think it would have A JNI call in it.
    I just gave it a whirl with AnonThread and can confirm it works when setting a TImage within the thread. I must admit I hadn’t realised the TImage Seg11 again would be JNI related.
    Thanks again.

  2. Pingback: Parallel Processing Loop With Delphi XE5 Firemonkey On Android And IOS | Delphi XE5 Firemonkey, Delphi Android, Delphi IOS

Leave a Reply

Show Buttons
Hide Buttons
Read previous post:
Massive Roundup Of Video Tutorials, Sessions, And Demos For Delphi XE5 Firemonkey

Embarcadero has a page up on their developer network site which links to all of their video sessions, tutorials, and...