https://beastlair.tistory.com/82
안드로이드 에서는 UI Thread 외부에서 UI 관련 작업을 호출 하면 Exception이 발생한다.
android.view.ViewRoot$CalledFromWrongThreadException: Only the original thread that created a view hierarchy can touch its views.
이와 같은 경우에는 Activity의 runOnUiThread 를 이용하여 해당 작업을 UI Thread 를 호출해 작업하면 문제를 회피할 수 있다.
--------------------------------------------------------------
new Thread(new Runnable() {
@Override
public void run() {
runOnUiThread(new Runnable(){
@Override
public void run() {
// 해당 작업을 처리함
}
});
}
}).start();
--------------------------------------------------------------