Code example for SharedPreferences

Methods: editgetIntgetLong

    private void showHint(int hintViewResource) {
        final SharedPreferences prefs = mPrefs;
        int numUniqueDaysShown = prefs.getInt(PREF_VOICE_HINT_NUM_UNIQUE_DAYS_SHOWN, 0);
        long lastTimeHintWasShown = prefs.getLong(PREF_VOICE_HINT_LAST_TIME_SHOWN, 0);
        // If this is the first time the hint is being shown today, increase the saved values 
        // to represent that. We don't need to increase the last time the hint was shown unless 
        // it is a different day from the current value. 
        if (!isFromToday(lastTimeHintWasShown)) {
            SharedPreferences.Editor editor = prefs.edit();
            editor.putInt(PREF_VOICE_HINT_NUM_UNIQUE_DAYS_SHOWN, numUniqueDaysShown + 1);
            editor.putLong(PREF_VOICE_HINT_LAST_TIME_SHOWN, System.currentTimeMillis());
        if (mDisplay != null) {