Advertisement
Guest User

Untitled

a guest
Jul 10th, 2014
179
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.49 KB | None | 0 0
  1.  
  2. @Override
  3. public void onBackPressed() {
  4.  
  5. new AlertDialog.Builder(this)
  6. .setIcon(android.R.drawable.ic_dialog_alert)
  7. .setTitle("Exit App")
  8. .setMessage("Are you sure you want to exit?")
  9. .setPositiveButton("Yes", new DialogInterface.OnClickListener() {
  10. public void onClick(DialogInterface dialog, int which) {
  11. finish();
  12. }
  13.  
  14. })
  15. .setNegativeButton("No", null)
  16. .show();
  17. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement