What is the difference when a class extend from Handler and Thread?
As described in developer.android.com
...
Each Handler instance is associated with a single thread and that thread's message queue.
...
Does the thread has no message queue ?
Any benefit for a class extend from Handler?
There is a major difference between a
Threadand aHandler.The Android
Handlerclass is used for communication between otherRunnable/Threadand the one that it has been created in.By posting to a given
Handler, you can add something for execution on its thread.You can also send messages from one thread and handle them on another.
Using
Handler, for example, is the preferred way to do delayed execution, instead of usingTimerTask. You can also notify your main thread that your worker thread has finished some task, withHandleras an alternative of sendingIntent.From Android Developer’s site: