I'm wondering when should I use handler.post(runnable);
and when should I use
new Thread(runnable).start();
It is mentioned in developers documentation for Handler:
Causes the Runnable r to be added to the message queue. The runnable will be run on the thread to which this handler is attached.
Does this mean if I write in the onCreate()
of Activity
class:
Handler handler = new Handler();
handler.post(runnable);
then runnable will be called in a separate thread or in the Activity's thread?