[Solved] Android show one time page [closed]


It’s easy. Use a Button with an onClickListener. Onec its clicked write a simple var to the sharedpreferences like in this sample:

SharedPreferences preferences = getSharedPreferences(PREFS_NAME,Context.MODE_PRIVATE);
SharedPreferences.Editor editor = preferences.edit();
editor.putBoolean("terms_accepted", true);

editor.commit();

As soon as your Main Activity starts check in onCreate if the terms has been accepted by validating the sharedpferences. Show it if the var is false or not there by using this for example:

SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(this);
boolean accepted = sharedPreferences.getBoolean("terms_accepted", false);

if (accepted) { ... run your code to spawn the terms dialog ... } 

Thats it. No magic.

solved Android show one time page [closed]