Guest User

Untitled

a guest
Jan 18th, 2019
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.20 KB | None | 0 0
  1. public void checkFirstRun() {
  2. boolean isFirstRun = getSharedPreferences("PREFERENCE", MODE_PRIVATE).getBoolean("isFirstRun", true);
  3. if (isFirstRun){
  4.  
  5. new AlertDialog.Builder(this)
  6. .setTitle("Agreement")
  7. .setMessage("Text")
  8. .setPositiveButton("Agree",
  9. new DialogInterface.OnClickListener() {
  10. @Override
  11. public void onClick(DialogInterface dialog, int which) {
  12. getSharedPreferences("PREFERENCE", MODE_PRIVATE)
  13. .edit()
  14. .putBoolean("isFirstRun", false)
  15. .apply();
  16. }
  17. })
  18. .setNegativeButton("Cencel",
  19. new DialogInterface.OnClickListener() {
  20. @Override
  21. public void onClick(DialogInterface dialog, int which) {
  22. dialog.dismiss();
  23. finish();
  24. }
  25. })
  26. .show();
  27.  
  28. }
  29. }
Add Comment
Please, Sign In to add comment