2011년 1월 7일 금요일

[Android] Worker Thread AND ProgressDialog Veiw

 

 

 

 

 

private ProgressDialog loagindDialog; // Loading Dialog

//스레드

 void createThreadAndDialog() {
        // ProgressDialog //
        loagindDialog = ProgressDialog.show(this, "Connecting",
                "Loading. Please wait...", true, false);
       
        Thread thread = new Thread(new Runnable() {
            public void run() {
                // 시간걸리는 처리
                handler.sendEmptyMessage(0);
            }
        });
        thread.start();
    }

 

//핸들러
  private Handler handler = new Handler() {
         public void handleMessage(Message msg) {
             loagindDialog.dismiss(); // 다이얼로그 삭제
             // View갱신
         }
     };
     
 
 createThreadAndDialog(); // 진행바 호출

 

 

 

 

 

 

 

 

 

댓글 없음:

댓글 쓰기