0
Thread = Worked Thread (not a main Thread/ UI Thread)
Looper.prepare(); = Attached MessageQueue with worker Thread

That MessageQueue only assigned with Main Thread now it also available with Worker Thread with the help of Looper

Looper.loop(); = start process message Queue

//Handler handler (somewhere declared globally)

handler = new Handler(); //attached handler to looper

handler instance will be use to post Message/Runnable in MessageQueue

My question is that then what is the significance of

public void handleMessage(android.os.Message msg);

Why I override it ????

Raghunandan
  • 132,755
  • 26
  • 225
  • 256
Amit Yadav
  • 32,664
  • 6
  • 42
  • 57
  • What? You override it and ask us why you did it? – selalerer Mar 26 '14 at 18:42
  • I attached Handler to Looper in either of the two ways, mHandler = new android.os.Handler() { public void handleMessage(android.os.Message msg) { } }; OR mHandler = new android.os.Handler(); What's the difference between them ??? – Amit Yadav Mar 26 '14 at 18:53
  • 1
    in the first case you can send Messages and post Runnables, in the second case you can only post Runnables – pskink Mar 26 '14 at 19:01

0 Answers0