Is the sub thread can operate UI? Or it can only use handler to operate in main thread. But I use this code. It did not launch the error. Is anyone has ideas?
new Thread(new Runnable() {
public void run() {
TextView tv=(TextView) findViewById(R.id.aaa);
tv.setText("111");
}
}).start();
No, you cannot perform UI operation from a different thread. If you want to update the UI, you must use handlers. Alternatively you can also use async tasks or Activity.runOnUiThread.