private Toast toast;
private long lastBackPressTime = 0;
@Override
public void onBackPressed() {
if (this.lastBackPressTime < System.currentTimeMillis() - 4000) {
toast = Toast.makeText(this, "Press back again to close this app", 4000);
toast.show();
this.lastBackPressTime = System.currentTimeMillis();
} else {
if (toast != null) {
toast.cancel();
}
super.onBackPressed();
}
}
software company in anand gujarat that focuses on website development, web hosting solutions, Android Development and Embedded Software Development which is founded in 2012. Purely focused on Opensource Initiative.
31 August 2014
How to show a dialog to confirm that the user wishes to exit an Android Activity?
7 August 2014
Subscribe to:
Posts (Atom)