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
}
};
试试这个。 让我知道这是否工作。