Get access to over 100 FireMonkey cross platform samples for Android, IOS, OSX, Windows, and Linux!

AndroidAppmethodComponentDelphiDemoFiremonkeyIOSOSXWindows

Threaded Progress Bar Image Loader For Delphi XE5 Firemonkey On Android And IOS

| Delphi 11 10 XE8 XE7 XE Seattle Berlin Tokyo Rio Firemonkey Delphi Android Delphi IOS

Delphi XE5 Firemonkey Asynchronous HTTP Image Loader | Delphi 11 10 XE8 XE7 XE Seattle Berlin Tokyo Rio Firemonkey Delphi Android Delphi IOSI put together this Delphi XE5 Firemonkey Frame object called AsyncImageLoader which implements a threaded HTTP image loader with a progress bar. If you want to load up a TListBox with an RSS feed you have to create an TImage and download each image manually which will block the GUI of your app. AsyncImageLoader shows one way to solve this problem. The code should work cross platform on Android, IOS, Windows, and IOS. Once you tell AsyncImageLoader to load an image it will display a progress bar until the image has been downloaded and loaded. Instagram uses a similar progress bar style within their app when they load images into your feed.

Another feature of AsyncImageLoader is that it can either pool the HTTP request components and re-use them the next time you load an image with the Frame or it can create the HTTP request components on each request (by setting Pooled to False). If you are only ever going to load an image once you can probably save memory by turning off pooling. Lastly you can load up the URL property of the Frame with the URL that you want to load and then use your own queuing system to load the images (with the Get procedure) when the images become visible (or one at a time). The threading is based on anonymous threads so there is also a new thread created and terminated for each image request.

There are other solutions out there for asynchronous image loading but I haven’t seen any that implement a progress bar. If you don’t need the progress bar and just want a threaded image loading queue check out TImageLoader.

To use AsyncImageLoader you should include the uAsyncImageLoader into your project, select Frames from the component palette, and choose AsyncImageLoader from the popup box.

Download the source code for the Delphi XE5 Firemonkey frame based AsyncImageLoader.

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

Related posts
DelphiDemoFiremonkeyLinuxOSXShowcaseWindows

AutoBlogAI: FireMonkey Client To Leverage LLMs And Generative AI For Blogging

DelphiFiremonkeyShowcaseUtilityWindows

Unleashing Creativity With Song Writer AI: A Deep Dive

DelphiFiremonkeyShowcaseWindows

How To Build Stable Diffusion Text To Image Prompts

AndroidC++BuilderDelphiFiremonkeyIOSOSXWindows

FireMonkey 10.4.2 Features Updated iOS 14, Android 11, And macOS 11 Support Plus Hundreds Of Fixes

Sign up for our Newsletter and
stay informed

19 Comments

Leave a Reply