0
我想在用戶設置的時間間隔內顯示警報框,並顯示警報框爲1分鐘。如果在1分鐘內沒有執行任何操作,則發送信息並撥打特定號碼。幫助解決我的問題。有人可以幫助我.....在時間間隔內顯示警報框
我想在用戶設置的時間間隔內顯示警報框,並顯示警報框爲1分鐘。如果在1分鐘內沒有執行任何操作,則發送信息並撥打特定號碼。幫助解決我的問題。有人可以幫助我.....在時間間隔內顯示警報框
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
}
};
試試這個。 讓我知道這是否工作。