我有一個Android的音樂應用程序。 訪問http://www.androidhive.info/2012/03/android-building-audio-player-tutorial/ 現在我需要在特定的時間關閉此應用程序。我應該使用什麼技術?如何設置計時器關閉android應用程序
感謝所有
我有一個Android的音樂應用程序。 訪問http://www.androidhive.info/2012/03/android-building-audio-player-tutorial/ 現在我需要在特定的時間關閉此應用程序。我應該使用什麼技術?如何設置計時器關閉android應用程序
感謝所有
嘗試Timer concept
new CountDownTimer(40000, 1000) { //40000 milli seconds is total time, 1000 milli seconds is time interval
public void onTick(long millisUntilFinished) {
}
public void onFinish() {
}
}.start();
可能是你可以使用AlarmManager。 見: http://developer.android.com/reference/android/app/AlarmManager.html Alarm Manager Example
在您AlarmReceiver或您的AlarmService,呼籲結束你的活動。
在Android中使用Handler或Timer概念 –