I am trying to make a popup dialog that only shows after the app\'s first run that will alert users of the new changes in the app. So I have a dialog popup like this:
<
loginPreferences = getSharedPreferences("loginPrefs", MODE_PRIVATE);
loginPrefsEditor = loginPreferences.edit();
doFirstRun();
private void doFirstRun() {
SharedPreferences settings = getSharedPreferences("PREFERENCE", MODE_PRIVATE);
if (settings.getBoolean("isFirstRun", true)) {
loginPrefsEditor.clear();
loginPrefsEditor.commit();
SharedPreferences.Editor editor = settings.edit();
editor.putBoolean("isFirstRun", false);
editor.commit();
}
}
I used this code to ensure that its the first time someone runs the application. The loginPrefsEditor is cleared from data because i have a "Remember Me" Button which stores the data to the sd card. Hope it helps !