Advertisement
Guest User

Untitled

a guest
Aug 26th, 2014
228
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.77 KB | None | 0 0
  1. public void onBackPressed() {
  2. if (isTaskRoot() && (layoutShown == LAYOUT_CRITERIA)) {
  3. new AlertDialog.Builder(this)
  4. .setIcon(android.R.drawable.ic_dialog_alert)
  5. .setTitle(R.string.confirmQuitTitle)
  6. .setMessage(R.string.confirmQuit)
  7. .setPositiveButton(R.string.confirmQuitYes,
  8. new DialogInterface.OnClickListener() {
  9. public void onClick(DialogInterface dialog,
  10. int which) {
  11. // Stop the activity
  12. Intent intent = new Intent(Intent.ACTION_MAIN);
  13. intent.addCategory(Intent.CATEGORY_HOME);
  14. intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
  15. startActivity(intent);
  16. finish();
  17. }
  18. }).setNegativeButton(R.string.confirmQuitNo, null)
  19. .show();
  20.  
  21. return;
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement