Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public void onBackPressed(){
- backpress = (backpress + 1);
- Toast.makeText(getApplicationContext(), " Press Back again to Exit ", Toast.LENGTH_SHORT).show();
- if (backpress>1) {
- this.finish();
- }
- }
- @Override
- public void onBackPressed() {
- new AlertDialog.Builder(this)
- .setTitle("Really Exit?")
- .setMessage("Are you sure you want to exit?")
- .setNegativeButton(android.R.string.no, null)
- .setPositiveButton(android.R.string.yes, new OnClickListener() {
- public void onClick(DialogInterface arg0, int arg1) {
- WelcomeActivity.super.onBackPressed();
- }
- }).create().show();
- }
Add Comment
Please, Sign In to add comment