I created a class
public class MyCountDownTimer extends CountDownTimer {
Activity activity;
public MyCountDownTimer(long startTime, long interval,Activity m_activity) {
super(startTime, interval);
activity = m_activity;
}
@Override
public void onFinish() {
//DO WHATEVER YOU WANT HERE
FunctionsUtil.ShowMessage("TERMINO SU TIEMPO",Toast.LENGTH_LONG);
valoresGenerales.banderaCountDownTimer = false;
android.os.Process.killProcess(android.os.Process.myPid());
}
@Override
public void onTick(long millisUntilFinished) {
if( millisUntilFinished/1000 == 35)
{
FunctionsUtil.ShowMessage("SI no usa en " + millisUntilFinished/1000 + " segundos se cerrara automáticamente.",Toast.LENGTH_LONG);
}
if( millisUntilFinished/1000 == 10)
{
FunctionsUtil.ShowMessage("SI no usa en " + millisUntilFinished/1000 + " segundos se cerrara automáticamente.",Toast.LENGTH_LONG);
}
}
}
as they know MyCountDownTimer .. is a counter back .. what I try to do is ... close my app when this counter reaches 0 and enter onFinish () I put the code
android.os.Process.killProcess(android.os.Process.myPid());
but doing tests I said that only closes a single activity (which is visible) and opens the actMain (main) automatically.
but I am my app has several activitys that open (activity 1 opens to activity2 that asu opens to activity 3 etc) that means that I have more than one activity in use and therefore the code does not help me.
what code could I use ???
thank you very much.