Last active
December 28, 2017 16:04
-
-
Save gvr23/d1dd7143e0faabfe7fe422086cbf0745 to your computer and use it in GitHub Desktop.
For restarting in an idle situation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ANDROID | |
=============================================================================================================================== | |
protected void reiniciarTimer(){ | |
cancelarTimer(); | |
timer = new Timer(); | |
TimerTask timerTask = new TimerTask() { | |
@Override | |
public void run() { | |
irPantalla(PromocionesActivity.class); | |
} | |
}; | |
timer.schedule(timerTask, Constantes.TIEMPO_INACTIVIDAD * 1000); | |
} | |
protected void cancelarTimer(){ | |
if(timer != null){ | |
timer.cancel(); | |
timer.purge(); | |
} | |
} | |
GO TO A CERTAIN ACTIVITY | |
=============================================================================================================================== | |
protected void irPantalla(Class clase){ | |
startActivity(new Intent(this, clase)); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment