标签:
new Thread(new Runnable() {
@Override
public void run() {
//处理ui线程的操作
// 方法1
runOnUiThread(new Runnable() {
@Override
public void run() {
mTextView.setText("hello");
}
});
//方法2
mTextView.post(new Runnable() {
@Override
public void run() {
mTextView.setText("hello");
}
});
//方法3
mTextView.postDelayed(new Runnable() {
@Override
public void run() {
mTextView.setText("hello");
}
}, 1000);
//方法4
//得到主线程的looper---handler
new Handler(Looper.getMainLooper()).post(
new Runnable() {
@Override
public void run() {
mTextView.setText("hello");
}
}
);
//处理耗时操作
}
});
标签:
原文地址:http://www.cnblogs.com/wisemen/p/5808025.html