0

Where can I find detailed explanation of threads like timer, async task, handler, looper etc in android?

Community
  • 1
  • 1
Ujjwal Chadha
  • 133
  • 2
  • 8
  • 2
    Possible duplicate of [What is the relationship between Looper, Handler and MessageQueue in Android?](http://stackoverflow.com/questions/12877944/what-is-the-relationship-between-looper-handler-and-messagequeue-in-android) – WenChao Mar 15 '17 at 05:46
  • "Where can I find detailed explanation of `x` in android?" [Here](https://developer.android.com/guide/index.html). – Cameron Mar 15 '17 at 06:06

1 Answers1

1

Here you go:

Timer

A facility for threads to schedule tasks for future execution in a background thread. Tasks may be scheduled for one-time execution, or for repeated execution at regular intervals.

Corresponding to each Timer object is a single background thread that is used to execute all of the timer's tasks, sequentially.

For more information check here.

AsyncTask

AsyncTask enables proper and easy use of the UI thread. This class allows you to perform background operations and publish results on the UI thread without having to manipulate threads and/or handlers.

AsyncTask is designed to be a helper class around Thread and Handler and does not constitute a generic threading framework.

For more information check here.

Handler

A Handler allows you to send and process Message and Runnable objects associated with a thread's MessageQueue. Each Handler instance is associated with a single thread and that thread's message queue.

When you create a new Handler, it is bound to the thread / message queue of the thread that is creating it -- from that point on, it will deliver messages and runnables to that message queue and execute them as they come out of the message queue.

For more information check here.

Looper

Class used to run a message loop for a thread. Threads by default do not have a message loop associated with them; to create one, call prepare() in the thread that is to run the loop, and then loop() to have it process messages until the loop is stopped.

For more information check here.

AndiGeeky
  • 11,266
  • 6
  • 50
  • 66