Looper, Thread and Handler


Can't create handler inside thread that has not called Looper.prepare()

new Thread(){  
    Handler handler = null;  
    public void run() {  
        handler = new Handler();  
    };  
}.start();
  1. One thread had the only one Looper and MessageQueue.
  2. Threads exchanged data(message) via Handler.
  3. You can also use "HandlerThread". It combined Thread, Looper and MessageQueue.
  4. RxJava is the best solution to handle Android Thread.

http://blog.csdn.net/bboyfeiyu/article/details/38555547
http://mindtherobot.com/blog/159/android-guts-intro-to-loopers-and-handlers/
http://givemepass-blog.logdown.com/posts/296790-how-to-use-handlerthread