Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public void checkFirstRun() {
- boolean isFirstRun = getSharedPreferences("PREFERENCE", MODE_PRIVATE).getBoolean("isFirstRun", true);
- if (isFirstRun){
- new AlertDialog.Builder(this)
- .setTitle("Agreement")
- .setMessage("Text")
- .setPositiveButton("Agree",
- new DialogInterface.OnClickListener() {
- @Override
- public void onClick(DialogInterface dialog, int which) {
- getSharedPreferences("PREFERENCE", MODE_PRIVATE)
- .edit()
- .putBoolean("isFirstRun", false)
- .apply();
- }
- })
- .setNegativeButton("Cencel",
- new DialogInterface.OnClickListener() {
- @Override
- public void onClick(DialogInterface dialog, int which) {
- dialog.dismiss();
- finish();
- }
- })
- .show();
- }
- }
Add Comment
Please, Sign In to add comment