안녕하세요~

현재 프로그레스바를 이용해서 일정시간이 지난후 시간과 프로그레스바가 일시정지가 되면서 다이얼로그가 뜨고 확인을 누르면다시 진행되는 소스를 구현하려고 하는데요.

 

시간이 흘러가면서 특정 시간에 다이얼로그 창뜨는건 되는데 일시정지와 다시진행을 어떻게 해야할지 모르겠습니다.

쓰레드를 넣어서 해야될거같긴한데 감이 안오네요 어떤부분을 공부해야하는지 가르쳐 주세요 ㅠ

==================================================

 

ProgressBar proBar;
 TextView timeTv; //시간
 Handler handler1;
 Handler handler2;
 Button startBtn;
 int mainTime = 0;
 int min, sec;
 //알람소리
 MediaPlayer player1,player2,player3,player4,player5;
 //현재상태 알림 다이얼로그
 AlertDialog dialog1,dialog2,dialog3,dialog4,dialog5,dialog6;
 
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.jori);
       
        proBar = (ProgressBar) findViewById(R.id.probar);
        timeTv = (TextView) findViewById(R.id.timeTv);
        startBtn = (Button) findViewById(R.id.starBtn);
        player1 = MediaPlayer.create(this, R.raw.mp);
        player2 = MediaPlayer.create(this, R.raw.dingdong);
        player3 = MediaPlayer.create(this, R.raw.click);
        player4 = MediaPlayer.create(this, R.raw.goodtime);
        player5 = MediaPlayer.create(this, R.raw.ddok);
       
        startBtn.setOnClickListener(new OnClickListener() {
   public void onClick(View v) {
    handler1.sendEmptyMessage(0);
    startBtn.setClickable(false);
   }
  });
       
        handler1 = new Handler(){
   @Override
   public void handleMessage(Message msg) {
    mainTime++;
    min = mainTime / 60;
    sec = mainTime % 60;
    String strTime = String.format("%02d : %02d", min, sec);
    timeTv.setText(strTime);
    
    proBar.incrementProgressBy(1);
    
    if(mainTime < 100){ //라면 시간 설정
     handler1.sendEmptyMessageDelayed(0, 1000);
    }
    
    if(mainTime == 3){
     player1.start();
     dialog1 = new AlertDialog.Builder(Ex_joriActivity.this)
     .setTitle("알립니다")
     .setMessage("물끓는중")
     .setPositiveButton("OK", new DialogInterface.OnClickListener() {
      public void onClick(DialogInterface dialog, int which) {
       player1.stop();
      }
     }).show();
    }
    
    if(mainTime == 10){
     player1.stop();
     player2.start();
     dialog1.cancel();
     dialog2 = new AlertDialog.Builder(Ex_joriActivity.this)
     .setTitle("알립니다")
     .setMessage("라면 쳐 넣어요")
     .setPositiveButton("OK", new DialogInterface.OnClickListener() {
      public void onClick(DialogInterface dialog, int which) {
       player2.stop();
      }
     }).show();
    }
    
    if(mainTime == 15){
     player2.stop();
     player3.start();
     dialog2.cancel();
     dialog3 = new AlertDialog.Builder(Ex_joriActivity.this)
     .setTitle("알립니다")
     .setMessage("스프 쳐 넣어요")
     .setPositiveButton("OK", new DialogInterface.OnClickListener() {
      public void onClick(DialogInterface dialog, int which) {
       player3.stop();
      }
     }).show();
    }
    
    if(mainTime == 20){
     player3.stop();
     player4.start();
     dialog3.cancel();
     dialog4 = new AlertDialog.Builder(Ex_joriActivity.this)
     .setTitle("알립니다")
     .setMessage("더 끓여!")
     .setPositiveButton("OK", new DialogInterface.OnClickListener() {
      public void onClick(DialogInterface dialog, int which) {
       player4.stop();
      }
     }).show();
    }
    
    if(mainTime == 25){
     player4.stop();
     player5.start();
     dialog4.cancel();
     dialog5 = new AlertDialog.Builder(Ex_joriActivity.this)
     .setTitle("알립니다")
     .setMessage("쳐묵쳐묵~")
     .setPositiveButton("OK", new DialogInterface.OnClickListener() {
      public void onClick(DialogInterface dialog, int which) {
       player5.stop();
      }
     }).show();
    }
   }
        };//handler
    }//oncreat

 

 

===============================================================