Can I have an android activity run only on the first time an application is opened?

后端 未结 5 817
时光说笑
时光说笑 2020-12-08 05:17

OK, so I\'m playing around with an android app.

The 90% use case is that users want to go straight to the primary list screen to find what they\'re looking for. Tha

5条回答
  •  借酒劲吻你
    2020-12-08 06:22

    After the first time the user has loaded the app you could store the details of whether user has performed the configurations in SharedPreferences.

     protected void storeSharedPrefs(String value) {
            /*
             * Storing in Shared Preferences
             */
            editor.putString("first", value);
            editor.commit();  //Commiting changes
        } 
    

    Check each on time application is loaded, whether its the first time and configuration details has been entered correctly by checking SharedPreferences

    private boolean first_time_check() {
            /* 
             * Checking Shared Preferences if the user had pressed 
             * the remember me button last time he logged in
             * */
            String first = uPreferences.getString("first", null);
            if((first == null)){
                return false;
            }
            else 
                return true;
        }
    

提交回复
热议问题