Configuring single shot help messages
A feature I have seen on other applications that I liked was one shot help messages. These are just shown to you the first time you use a feature, access a page, view a chart etc. They don't show up again for the same user. They don't therefore annoy the user, but they don't leave them to flounder either.
This is how I do this. In the onResume of the Activity that you want to nudge the user you put this code:
SharedPreferences mPrefs = PreferenceManager.getDefaultSharedPreferences(Dashboard.this);
boolean oneTimeHelpShown = mPrefs
.getBoolean(ONE_TIME_HELP_SHOWN, false);
if (!oneTimeHelpShown) {
Toast.makeText(Dashboard.this, R.string.one_time_help,
Toast.LENGTH_LONG).show();
SharedPreferences.Editor editor = mPrefs.edit();
editor.putBoolean(ONE_TIME_HELP_SHOWN, true);
editor.commit();
}
It grabs a boolean from the default shared preferences to determine whether or not to show the guide toast. If the help has not been show before the value is set in the preferences and committed. This prevents the reshow.
I also did this for a TextView at the top of the Activity. This required an else on the end of that if which set the Visibility to GONE. This method has the advantage of staying on the screen as long as the user is on their first visit, but is also sits right in your nice layout - potentially making it non-nice :(
This is how I do this. In the onResume of the Activity that you want to nudge the user you put this code:
SharedPreferences mPrefs = PreferenceManager.getDefaultSharedPreferences(Dashboard.this);
boolean oneTimeHelpShown = mPrefs
.getBoolean(ONE_TIME_HELP_SHOWN, false);
if (!oneTimeHelpShown) {
Toast.makeText(Dashboard.this, R.string.one_time_help,
Toast.LENGTH_LONG).show();
SharedPreferences.Editor editor = mPrefs.edit();
editor.putBoolean(ONE_TIME_HELP_SHOWN, true);
editor.commit();
}
It grabs a boolean from the default shared preferences to determine whether or not to show the guide toast. If the help has not been show before the value is set in the preferences and committed. This prevents the reshow.
I also did this for a TextView at the top of the Activity. This required an else on the end of that if which set the Visibility to GONE. This method has the advantage of staying on the screen as long as the user is on their first visit, but is also sits right in your nice layout - potentially making it non-nice :(
Comments
Post a Comment