2012-02-18 5 views
0

사용자가 설정 한 시간 간격 동안 alertbox를 표시하고 1 분 동안 alertbox를 표시하려고합니다. 1 분 이내에 조치가 수행되지 않으면 메시지를 보내고 특정 번호로 전화를 걸 수 있습니다. 제발 내 문제를 해결하는 데 도움이됩니다. 누구든지 나를 도울 수 있습니다 .....시간 간격 동안 경고 상자를 표시하려면

답변

2
Timer myTimer; 
myTimer = new Timer(); 
      myTimer.schedule(new TimerTask() { 
       @Override 
       public void run() { 
        TimerMethod(); 
       } 

      }, 0, 10000); 
     } 

    } 
    private void TimerMethod() 
    { 
     //This method is called directly by the timer 
     //and runs in the same thread as the timer. 

     //We call the method that will work with the UI 
     //through the runOnUiThread method. 
     this.runOnUiThread(Timer_Tick); 

    } 

    private Runnable Timer_Tick = new Runnable() { 
     public void run() { 

     //This method runs in the same thread as the UI.    

     //Do something to the UI thread here 


     } 
    }; 

이 항목을 사용해보십시오. 이것이 작동하는지 알려주세요.