//case 1:post to main thread's handler
mHandler.post(new Runnable(){
public void run(){
dosomething(); //update UI
});
//case 2:run in main thread
dosomething();
//case 1:post to main thread’s handler mHandler.post(new Runnable(){ public void run(){ dosomething(); //update UI
Share
Even if you are on the handler’s thread, case 1 will be queued and case 2 will be executed immediately.