Double Back Press to Exit Application In Android
by Sasikumar[ Edit ] 2013-11-05 10:18:09
To make Double back press to exit application :
To make Double back press to exit application use following,
private static long back_pressed;
@Override
public void onBackPressed()
{
if (back_pressed + 2000 > System.currentTimeMillis()) super.onBackPressed();
else Toast.makeText(getBaseContext(), "Press Back again to exit!", Toast.LENGTH_SHORT).show();
back_pressed = System.currentTimeMillis();
}