2010-10-12 91 views

回答

1

使用Activity.runOnUiThread()确保您的代码运行在正确的线程中。

//assuming this code is within an Activity class, you can 
    //access this function directly. Otherwise you must 
    //have a reference to an Activity object 
    this.runOnUiThread(new Runnable() 
    { 
     public void run() 
     { 
      //perform UI-thread only tasks 
     } 
    }); 
相关问题