Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android make a first time use screen [duplicate]

I want to implement a screen that appears when the user uses the app for the first time, like google does. Is there a special element to use? What would be the best method to check if the user opened the app for the first time?

like image 528
Broadwell Avatar asked May 03 '26 03:05

Broadwell


1 Answers

Take a look into SharedPreferences. It's pretty simple.

    SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(this);

    boolean firstOpened = preferences.getBoolean("first_opened", true);

    if(firstOpenened) {

         showWelcomeScreen();

         SharedPreferences.Editor editor = preferences.edit();
         editor.putBoolean("first_opened", false);
         editor.apply();
    }
like image 178
Bene Avatar answered May 04 '26 18:05

Bene