- A service is an Android component that lives independently from any other components. Activities may come and go, but services can stick around, if you wish. They serve a number of roles, from managing state that multiple activities rely upon to serving as cron jobs to handling longer app widget updates.
AsyncTask
is a class that arranges to do some work off the main application thread. From the implementer and user of theAsyncTask
, how it performs that bit of magic is not generally important. In reality, it uses a thread pool and work queue.AsyncTask
uses aHandler
to help arrange for select bits of work to be done on the main application thread (e.g., notifying the user of progress updates).Handler
is a class that is tied tightly into the message queue and loop that forms the backbone of the main application thread. The primary purpose of aHandler
in application code is to arrange for messages to be sent from background threads to the main application thread, mostly to arrange for updates to the UI, which cannot be done from background threads.
Here, I post stuff that i have got chance to explore. I put in the links to the articles that i find most suitable, and as i explore the topic more i add my own comments as well.
Saturday, 7 April 2012
Andorid Service vs AsyncTask vs Handler
Labels:
Android
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment