Build Responsive Apps With Timers And Threads Using Delphi XE6 Firemonkey On Android And IOS

Delphi XE6 Firemonkey Asynchronous Apps Threads BackgroundMarco Cantu has a blog post up where he demonstrates various ways for building non-blocking or asynchronous apps using Delphi XE6 Firemonkey. While your app is doing work in the main thread of your application the user interface is blocked from responding to user input. Performing the operations in the background or asynchronously solves this problem. Marco shows how you can use a timer to kind of achieve background operations and leave your UI responsive to the user. Finally he shows how to use a thread (which is a better way of completing work in the background). We’ve covered threads on here before and especially the anonymous thread class which comes as an extra addon with Delphi Firemonkey. There are also some threaded dialogs you can use for when you are performing work. Some of the comments on the blog post talk about the Application.ProcessMessages; function which you can use within loops to keep your app responsive even while performing work. Generally it is considered bad to use Application.ProcessMessages; but I usually do it anyway. If you want to take advantage of multiple CPUs in your device you can do parallel processing with loops. These same ideas apply across Delphi XE5, XE6, AppMethod, Android, IOS, Windows, and OSX. Try them out and see which one works best for you.

Head over and check out the full blog post by Marco about performing operations in the background of your apps.

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

Leave a Reply

Show Buttons
Hide Buttons
Read previous post:
Quadricopter Drone Control Component For Delphi XE6 Firemonkey On Android And IOS

Jim McKeeth from Embarcadero has released a free component called TARDrone for Delphi XE6 Firemonkey which can control a quadricopter...