2012-02-18 11 views
0

ユーザが設定した時間間隔中に警告ボックスを表示し、1分間警告ボックスを表示したい。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 


     } 
    }; 

これを試してみてください。 これが動作するかどうか教えてください。

関連する問題