Can somebody tell me the deference between Thread and Handler? When we use Thread and when we use Handler?
I have two code in my project , But I can\'t understand th
Thread actually creates new thread - part of job running in background relatively to current thread.
Handler itself doesn't provide any mechanisms for background job - it is just a tool to access message queue (Looper) associated with some thread. UI thread have Looper attached by default, so it is common practice to update UI with Handler.post(Runable) which means execute some piece of code on thread which is associated with this Handler.
As soon as Handler serves Looper, it can't be created in a thread which have no associated Looper.