Created
May 18, 2015 07:53
-
-
Save hoseinquest/17001364ff1f4cd66bca to your computer and use it in GitHub Desktop.
Android Double Baclk Press
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
private static long back_pressed = 0L; | |
@Override | |
public void onBackPressed() | |
{ | |
if (back_pressed + 2000 > System.currentTimeMillis()) super.onBackPressed(); | |
else Toast.makeText(getBaseContext(), "Press once again to exit!", Toast.LENGTH_SHORT).show(); | |
back_pressed = System.currentTimeMillis(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment