Abstract
In this paper we describe an experience on multithreading using Java concurrency classes and Android's Handler class. The Handler class is a new idiom designed for Android inter-thread communication; it combines features from a BlockingQueue and a message listener. It is especially helpful for apps based on the 'producer-consumer' pattern. A Handler object on the main thread (consumer) exposes a thread-safe queue on which background workers (producers) can asynchronously append either messages or requests for foreground runnables to act on their behalf. The Handler's listener waits for new messages carrying data and requests to be serviced by the main activity. An Android app using these features is discussed.
| Original language | English |
|---|---|
| Number of pages | 7 |
| Journal | Journal of Computing Sciences in Colleges |
| Volume | 30 |
| Issue number | 1 |
| State | Published - 2014 |
Cite this
- APA
- Author
- BIBTEX
- Harvard
- Standard
- RIS
- Vancouver