Monday, May 24, 2010

Android concurrency

I really like the way Android handles concurrency with its Handler and Looper classes. E.g., it helps you if you want to perform some task as background job and later push back the results to the calling thread via message passing. For convenience, there is also the AsyncTask class which does all the Handler, Looper and thread pool stuff for you. The callback interface of AsyncTask ("onProgressUpdate""onPostExecute", etc.) will be executed within the context of the calling thread (e.g. the UI thread). That's really nice :-).
In this way Android reminds me very much of Erlang or QNX Neutrino RTOS.

I also used this classes in Quickdroid a lot. Quickdroid allows you to quickly search, find and launch apps, contacts, bookmarks, artists, albums and songs on your Android phone. It is just like Quicksilver for Mac OS X, Launchy for Microsoft Windows or GNOME Do for Linux.
The Quickdroid source code is freely available here under the Apache 2 license.