자답 입니다.
반복문에서 업데이트 하면 죽네요. 죽어야 정상이라고 생각했는데 안죽어서 희한하다고 생각했는데
반복문에서 업데이트 하니 i == 1에서 ui 쓰레드에서 Only the original thread that created a view hierarchy can touch its views. 문구가 나왔습니다. getMainLooper()에 연결하면 당연히 안죽습니다. onClickListener에서는 반복문 안해도 한번에 죽네요. 아시는 분 답변부탁드립니다.
Handler h = new Handler(getMainLooper())
public void handleMessage(Message msg)
{
Log.d(TAG, Thread.currentThread().getName());
Log.d(TAG, Thread.currentThread().getThreadGroup().getName());
int i = 0;
while (i < 10)
{
Log.d(TAG, "i : " + i);
btnTest.setText("test" + i);
i++;
try
{
Thread.sleep(2000);
} catch (InterruptedException e)
{
e.printStackTrace();
}
}
}