2014年4月22日 星期二

Handler, AsyncTask and Thread

Sometime confused about the differences between Handlers, AsyncTasks and Threads in Android.
If I have a time time consuming job that without relating with UI thread, should I use which one?

A stackoverflow thread show good answer:
http://stackoverflow.com/questions/6964011/handler-vs-asynctask-vs-thread

I know that:
1. All the things Handler and  AsyncTask can do, it can do with Thread.
2. Use AsyncTask when you are in UI thread.
3. Handler allows you to send and process Message and Runnable objects associated with a thread's MessageQueue <- and="" callback.="" form="" hide="" i="" it="" native="" preview="" show="" span="" surface="" to="" use="">