问题描述:

While this will work:

new Thread(new Classimplementingrunnable(stuff, dostuff()).start();

This will not:

new Thread(){

public void run(){

Log.i("tag", "I am inside thread");

dostuff();

}

};

No error occurs, it will just ignore it and it wont start a seperate thread, so "I am inside thread" will not show.

网友答案:

You need to call the start() method on your Thread inorder to make it run.

new Thread(){
    @Override
    public void run(){
        Log.i("tag", "I am inside thread");
        dostuff();
    }
}.start();
相关阅读:
Top