Can somebody tell me the deference between Thread and Handler? When we use Thread and when we use Handler?
I have two code in my project , But I can't understand them.
final Handler handler = new Handler()
{
@Override
public void handleMessage(Message msg)
{
// Do SomeThings
}
};
And
private class readThread extends Thread
{
Handler mHandler;
readThread(Handler h){
mHandler = h;
this.setPriority(Thread.MIN_PRIORITY);
}
@Override
public void run()
{
// Do SomeThings
}
}
And in another method call the handler like this
read_thread = new readThread(handler);
read_thread.start();
Which one run first?? Can somebody explain me?