@@ -415,19 +415,20 @@ public Preference findPreference(CharSequence key) {
415415 }
416416
417417 /**
418- * Sets the default values from a preference hierarchy in XML. This should
418+ * Sets the default values from an XML preference file by reading the values defined
419+ * by each {@link Preference} item's {@code android:defaultValue} attribute. This should
419420 * be called by the application's main activity.
420421 * <p>
421- * If {@code readAgain} is false, this will only set the default values if this
422- * method has never been called in the past (or the
423- * {@link #KEY_HAS_SET_DEFAULT_VALUES} in the default value shared
424- * preferences file is false). To attempt to set the default values again
425- * bypassing this check, set {@code readAgain} to true.
426422 *
427423 * @param context The context of the shared preferences.
428- * @param resId The resource ID of the preference hierarchy XML file.
424+ * @param resId The resource ID of the preference XML file.
429425 * @param readAgain Whether to re-read the default values.
430- * <p>
426+ * If false, this method sets the default values only if this
427+ * method has never been called in the past (or if the
428+ * {@link #KEY_HAS_SET_DEFAULT_VALUES} in the default value shared
429+ * preferences file is false). To attempt to set the default values again
430+ * bypassing this check, set {@code readAgain} to true.
431+ * <p class="note">
431432 * Note: this will NOT reset preferences back to their default
432433 * values. For that functionality, use
433434 * {@link PreferenceManager#getDefaultSharedPreferences(Context)}
@@ -445,6 +446,25 @@ public static void setDefaultValues(Context context, int resId, boolean readAgai
445446 * Similar to {@link #setDefaultValues(Context, int, boolean)} but allows
446447 * the client to provide the filename and mode of the shared preferences
447448 * file.
449+ *
450+ * @param context The context of the shared preferences.
451+ * @param sharedPreferencesName A custom name for the shared preferences file.
452+ * @param sharedPreferencesMode The file creation mode for the shared preferences file, such
453+ * as {@link android.content.Context#MODE_PRIVATE} or {@link
454+ * android.content.Context#MODE_PRIVATE}
455+ * @param resId The resource ID of the preference XML file.
456+ * @param readAgain Whether to re-read the default values.
457+ * If false, this method will set the default values only if this
458+ * method has never been called in the past (or if the
459+ * {@link #KEY_HAS_SET_DEFAULT_VALUES} in the default value shared
460+ * preferences file is false). To attempt to set the default values again
461+ * bypassing this check, set {@code readAgain} to true.
462+ * <p class="note">
463+ * Note: this will NOT reset preferences back to their default
464+ * values. For that functionality, use
465+ * {@link PreferenceManager#getDefaultSharedPreferences(Context)}
466+ * and clear it followed by a call to this method with this
467+ * parameter set to true.
448468 *
449469 * @see #setDefaultValues(Context, int, boolean)
450470 * @see #setSharedPreferencesName(String)
0 commit comments