Loading core/java/android/preference/PreferenceManager.java +28 −8 Original line number Original line Diff line number Diff line Loading @@ -415,19 +415,20 @@ public class PreferenceManager { } } /** /** * Sets the default values from a preference hierarchy in XML. This should * Sets the default values from an XML preference file by reading the values defined * by each {@link Preference} item's {@code android:defaultValue} attribute. This should * be called by the application's main activity. * be called by the application's main activity. * <p> * <p> * If {@code readAgain} is false, this will only set the default values if this * method has never been called in the past (or the * {@link #KEY_HAS_SET_DEFAULT_VALUES} in the default value shared * preferences file is false). To attempt to set the default values again * bypassing this check, set {@code readAgain} to true. * * * @param context The context of the shared preferences. * @param context The context of the shared preferences. * @param resId The resource ID of the preference hierarchy XML file. * @param resId The resource ID of the preference XML file. * @param readAgain Whether to re-read the default values. * @param readAgain Whether to re-read the default values. * <p> * If false, this method sets the default values only if this * method has never been called in the past (or if the * {@link #KEY_HAS_SET_DEFAULT_VALUES} in the default value shared * preferences file is false). To attempt to set the default values again * bypassing this check, set {@code readAgain} to true. * <p class="note"> * Note: this will NOT reset preferences back to their default * Note: this will NOT reset preferences back to their default * values. For that functionality, use * values. For that functionality, use * {@link PreferenceManager#getDefaultSharedPreferences(Context)} * {@link PreferenceManager#getDefaultSharedPreferences(Context)} Loading @@ -446,6 +447,25 @@ public class PreferenceManager { * the client to provide the filename and mode of the shared preferences * the client to provide the filename and mode of the shared preferences * file. * file. * * * @param context The context of the shared preferences. * @param sharedPreferencesName A custom name for the shared preferences file. * @param sharedPreferencesMode The file creation mode for the shared preferences file, such * as {@link android.content.Context#MODE_PRIVATE} or {@link * android.content.Context#MODE_PRIVATE} * @param resId The resource ID of the preference XML file. * @param readAgain Whether to re-read the default values. * If false, this method will set the default values only if this * method has never been called in the past (or if the * {@link #KEY_HAS_SET_DEFAULT_VALUES} in the default value shared * preferences file is false). To attempt to set the default values again * bypassing this check, set {@code readAgain} to true. * <p class="note"> * Note: this will NOT reset preferences back to their default * values. For that functionality, use * {@link PreferenceManager#getDefaultSharedPreferences(Context)} * and clear it followed by a call to this method with this * parameter set to true. * * @see #setDefaultValues(Context, int, boolean) * @see #setDefaultValues(Context, int, boolean) * @see #setSharedPreferencesName(String) * @see #setSharedPreferencesName(String) * @see #setSharedPreferencesMode(int) * @see #setSharedPreferencesMode(int) Loading docs/html/guide/components/fragments.jd +6 −0 Original line number Original line Diff line number Diff line Loading @@ -709,6 +709,12 @@ href="{@docRoot}guide/components/activities.html#Lifecycle">managing the activit lifecycle</a> also apply to fragments. What you also need to understand, though, is how the life lifecycle</a> also apply to fragments. What you also need to understand, though, is how the life of the activity affects the life of the fragment.</p> of the activity affects the life of the fragment.</p> <p class="caution"><strong>Caution:</strong> If you need a {@link android.content.Context} object within your {@link android.app.Fragment}, you can call {@link android.app.Fragment#getActivity()}. However, be careful to call {@link android.app.Fragment#getActivity()} only when the fragment is attached to an activity. When the fragment is not yet attached, or was detached during the end of its lifecycle, {@link android.app.Fragment#getActivity()} will return null.</p> <h3 id="CoordinatingWithActivity">Coordinating with the activity lifecycle</h3> <h3 id="CoordinatingWithActivity">Coordinating with the activity lifecycle</h3> Loading docs/html/guide/guide_toc.cs +3 −0 Original line number Original line Diff line number Diff line Loading @@ -197,6 +197,9 @@ <li><a href="<?cs var:toroot ?>guide/topics/ui/actionbar.html"> <li><a href="<?cs var:toroot ?>guide/topics/ui/actionbar.html"> <span class="en">Action Bar</span> <span class="en">Action Bar</span> </a></li> </a></li> <li><a href="<?cs var:toroot ?>guide/topics/ui/settings.html"> <span class="en">Settings</span> </a></li> <li class="nav-section"> <li class="nav-section"> <div class="nav-section-header"><a href="<?cs var:toroot ?>guide/topics/ui/notifiers/index.html"> <div class="nav-section-header"><a href="<?cs var:toroot ?>guide/topics/ui/notifiers/index.html"> <span class="en">Notifications</span> <span class="en">Notifications</span> Loading Loading
core/java/android/preference/PreferenceManager.java +28 −8 Original line number Original line Diff line number Diff line Loading @@ -415,19 +415,20 @@ public class PreferenceManager { } } /** /** * Sets the default values from a preference hierarchy in XML. This should * Sets the default values from an XML preference file by reading the values defined * by each {@link Preference} item's {@code android:defaultValue} attribute. This should * be called by the application's main activity. * be called by the application's main activity. * <p> * <p> * If {@code readAgain} is false, this will only set the default values if this * method has never been called in the past (or the * {@link #KEY_HAS_SET_DEFAULT_VALUES} in the default value shared * preferences file is false). To attempt to set the default values again * bypassing this check, set {@code readAgain} to true. * * * @param context The context of the shared preferences. * @param context The context of the shared preferences. * @param resId The resource ID of the preference hierarchy XML file. * @param resId The resource ID of the preference XML file. * @param readAgain Whether to re-read the default values. * @param readAgain Whether to re-read the default values. * <p> * If false, this method sets the default values only if this * method has never been called in the past (or if the * {@link #KEY_HAS_SET_DEFAULT_VALUES} in the default value shared * preferences file is false). To attempt to set the default values again * bypassing this check, set {@code readAgain} to true. * <p class="note"> * Note: this will NOT reset preferences back to their default * Note: this will NOT reset preferences back to their default * values. For that functionality, use * values. For that functionality, use * {@link PreferenceManager#getDefaultSharedPreferences(Context)} * {@link PreferenceManager#getDefaultSharedPreferences(Context)} Loading @@ -446,6 +447,25 @@ public class PreferenceManager { * the client to provide the filename and mode of the shared preferences * the client to provide the filename and mode of the shared preferences * file. * file. * * * @param context The context of the shared preferences. * @param sharedPreferencesName A custom name for the shared preferences file. * @param sharedPreferencesMode The file creation mode for the shared preferences file, such * as {@link android.content.Context#MODE_PRIVATE} or {@link * android.content.Context#MODE_PRIVATE} * @param resId The resource ID of the preference XML file. * @param readAgain Whether to re-read the default values. * If false, this method will set the default values only if this * method has never been called in the past (or if the * {@link #KEY_HAS_SET_DEFAULT_VALUES} in the default value shared * preferences file is false). To attempt to set the default values again * bypassing this check, set {@code readAgain} to true. * <p class="note"> * Note: this will NOT reset preferences back to their default * values. For that functionality, use * {@link PreferenceManager#getDefaultSharedPreferences(Context)} * and clear it followed by a call to this method with this * parameter set to true. * * @see #setDefaultValues(Context, int, boolean) * @see #setDefaultValues(Context, int, boolean) * @see #setSharedPreferencesName(String) * @see #setSharedPreferencesName(String) * @see #setSharedPreferencesMode(int) * @see #setSharedPreferencesMode(int) Loading
docs/html/guide/components/fragments.jd +6 −0 Original line number Original line Diff line number Diff line Loading @@ -709,6 +709,12 @@ href="{@docRoot}guide/components/activities.html#Lifecycle">managing the activit lifecycle</a> also apply to fragments. What you also need to understand, though, is how the life lifecycle</a> also apply to fragments. What you also need to understand, though, is how the life of the activity affects the life of the fragment.</p> of the activity affects the life of the fragment.</p> <p class="caution"><strong>Caution:</strong> If you need a {@link android.content.Context} object within your {@link android.app.Fragment}, you can call {@link android.app.Fragment#getActivity()}. However, be careful to call {@link android.app.Fragment#getActivity()} only when the fragment is attached to an activity. When the fragment is not yet attached, or was detached during the end of its lifecycle, {@link android.app.Fragment#getActivity()} will return null.</p> <h3 id="CoordinatingWithActivity">Coordinating with the activity lifecycle</h3> <h3 id="CoordinatingWithActivity">Coordinating with the activity lifecycle</h3> Loading
docs/html/guide/guide_toc.cs +3 −0 Original line number Original line Diff line number Diff line Loading @@ -197,6 +197,9 @@ <li><a href="<?cs var:toroot ?>guide/topics/ui/actionbar.html"> <li><a href="<?cs var:toroot ?>guide/topics/ui/actionbar.html"> <span class="en">Action Bar</span> <span class="en">Action Bar</span> </a></li> </a></li> <li><a href="<?cs var:toroot ?>guide/topics/ui/settings.html"> <span class="en">Settings</span> </a></li> <li class="nav-section"> <li class="nav-section"> <div class="nav-section-header"><a href="<?cs var:toroot ?>guide/topics/ui/notifiers/index.html"> <div class="nav-section-header"><a href="<?cs var:toroot ?>guide/topics/ui/notifiers/index.html"> <span class="en">Notifications</span> <span class="en">Notifications</span> Loading