Listing 912 Synchronizing with the Activitys GUI thread Available for

download on runOnUiThread(new Runnable() { Wrox.com public void run() {

In other circumstances (such as Toasts and Notifications) you can use the Handler class to post methods onto the thread in which the Handler was created.

Using the Handler class you can post updates to the user interface from a background thread using the Post method. Listing 9-13 shows the outline for using the Handler to update the GUI thread.

Mobile Apps Made Easy

Mobile Apps Made Easy

Quick start guide to skyrocket your offline and online business success with mobile apps. If you know anything about mobile devices, you’ve probably heard that famous phrase coined by one of the mobile device’s most prolific creators proclaiming that there’s an app for pretty much everything.

Get My Free Training Guide


Post a comment