1.在oncreat()里面添加
new Thread(new Runnable() {
@Override
public void run() {
Message msg = new Message();
msg.what = 0;
myHandler.sendMessage(msg);
Message msg1 = myHandler.obtainMessage();// ͬ new Message();
msg1.what = 1;
myHandler.sendMessage(msg1);
}
}).start();
2.在外面
Handler myHandler = new Handler() {
public void handleMessage(Message msg) {
switch (msg.what) {
case 0:
textView1.setText("wo shi text1");
break;
case 1:
textView2.setText("wo shi text2");
break;
}
};
};