-
Notifications
You must be signed in to change notification settings - Fork 0
Settings with PreferenceFragment
In Android apps, there are often settings pages that contain different options the user can tweak. The PreferenceFragment contains a hierarchy of preference objects displayed on screen in a list. These preferences will automatically save to SharedPreferences as the user interacts with them.
To retrieve an instance of SharedPreferences
that the preference hierarchy in this fragment will use, call PreferenceManager.getDefaultSharedPreferences(android.content.Context)
with a context in the same package as this fragment.
Needs attention
- http://developer.android.com/reference/android/preference/PreferenceFragment.html
- http://developer.android.com/guide/topics/ui/settings.html
- http://www.mysamplecode.com/2011/11/android-shared-preferences-example_12.html
- http://mobile.tutsplus.com/tutorials/android/android-user-interface-design-building-application-preference-screens/
- http://gmariotti.blogspot.com/2013/01/preferenceactivity-preferencefragment.html
Created by CodePath with much help from the community. Contributed content licensed under cc-wiki with attribution required. You are free to remix and reuse, as long as you attribute and use a similar license.
Finding these guides helpful?
We need help from the broader community to improve these guides, add new topics and keep the topics up-to-date. See our contribution guidelines here and our topic issues list for great ways to help out.
Check these same guides through our standalone viewer for a better browsing experience and an improved search. Follow us on twitter @codepath for access to more useful Android development resources.
Interested in ramping up on Android quickly?
(US Only) If you are an existing engineer with 2+ years of professional experience in software development and are serious about ramping up on Android quickly, be sure to apply for our free evening 8-week Android bootcamp.
We've trained over a thousand engineers from top companies including Apple, Twitter, Airbnb, Uber, and many others leveraging this program. The course is taught by Android experts from the industry and is specifically designed for existing engineers.
Not in the United States? Please fill out our application of interest form and we’ll notify you as classes become available in your area powered by local organizers.