Android: First run popup dialog

前端 未结 6 2183
感情败类
感情败类 2020-12-04 11:50

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:

<
6条回答
  •  臣服心动
    2020-12-04 11:59

    I use this to display a help dialog on first run. I don't want this to show after an update. That is better suited for a changelog.

    private void doFirstRun() {
            SharedPreferences settings = getSharedPreferences(PREFS_NAME, MODE_PRIVATE);
            if (settings.getBoolean("isFirstRun", true)) {
                showDialog(DIALOG_HELP);
                SharedPreferences.Editor editor = settings.edit();
                editor.putBoolean("isFirstRun", false);
                editor.commit();
            }
    }
    

提交回复
热议问题