public class ccc extends Activity {
 
 TextView text1;
 BackThread bt;
 
 
 
 public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
       
    text1 = (TextView)findViewById(R.id.text1);
    bt = new BackThread(hd);
    bt.setDaemon(true);
    bt.start();
 }
    
 Handler hd = new Handler() {
  public void handleMessage(Message msg) {
   if (msg.what == 0) {
    text1.setText("" + msg.arg1);
   }
  }
 };
 
 
 class BackThread extends Thread {
  int m = 0;
  Handler hd;
  
  BackThread(Handler handler){
   hd = handler;
  }
  
  public void run() {
   while (true) {
    m++;
    Message msg = Message.obtain(hd,0, m,0);
    hd.sendMessage(msg);
    
    try {
     Thread.sleep(1000);
    } catch (InterruptedException e) {
     e.printStackTrace();
    }
   }
  }
 }
 
}


초마다 TextView 를 +1씩갱신시키게되는 소스입니다

 

 

스레드 클래스의 run메서드에서 msg에 값을 넣어서 핸들러메서드에 값을 전달해주는것으로 이해했는데

궁금한것은 쓰레드클래스는 while문으로 계속돌아가면서 초당 1씩 증가되며 msg에 값 넣어주는것은 알겠는데

핸들러메서드는 실행하라는 명령이 while안에 따로없는것 어떻게 계속 실행되면서 뿌려주는걸까요??