0

I have a music app in android. Visit http://www.androidhive.info/2012/03/android-building-audio-player-tutorial/ Now I need to close this app with specific time. What is technique I should use?

Thank all

Jonathan Leffler
  • 730,956
  • 141
  • 904
  • 1,278
jupiter
  • 143
  • 1
  • 11

2 Answers2

0

try 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();
Tarsem Singh
  • 14,139
  • 7
  • 51
  • 71
0

May be you can use AlarmManager. See : http://developer.android.com/reference/android/app/AlarmManager.html Alarm Manager Example

On your AlarmReceiver or your AlarmService, call finish on your activity.

Community
  • 1
  • 1