An Experience on Multithreading using Android's Handler Class

  • Victor M Matos

Research output: Contribution to journalArticle

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 languageEnglish
Number of pages7
JournalJournal of Computing Sciences in Colleges
Volume30
Issue number1
StatePublished - 2014

Cite this