新建线程
new Thread(new Runnable()
线程方法:
public void run()
1 private void setAddWidgetEnabled(boolean enabled,boolean iscomplete) { 2 mbtn_contactin_begin.setEnabled(enabled); 3 if (iscomplete) { 4 new Thread(new Runnable() { 5 public void run() { 6 runOnUiThread(new Runnable() { 7 public void run() { 8 9 mbtn_contactin_begin 10 .setText(getString(R.string.aio_ime_action_label)); 11 mbtn_contactin_begin.setEnabled(false); 12 } 13 }); 14 } 15 }).start(); 16 } 17 18 }
注意:runOnUiThread是activity.runOnUiThread,并非Context.runOnUiThread.