Shared preferences can also be managed through preference activities. These are activities with an automated user interface that’s managed by the framework. You define these preferences in an XML file, similar to an XML menu file, and then access the values with Java code. You then manage the settings with an activity that loads a single fragment; the fragment does the actual work of managing the preferences user interface.
- [Instructor] I've previously discussed how to manage…shared preferences from java code.…You can also manage preferences…through preference activities.…These are activities with an automated user interface…that's managed by the framework.…You define your preferences in an XML file,…similar to an XML menu file…and then access the values with java code.…Typically, you should wrap your preferences screen…in a fragment, so that it maintains its state…as the devices orientation or other configuration changes.…
In this version of the application I've added a new activity…class called prefsactivity.java.…It has an XML layout file that includes just…a single frame layout.…I've also added an item to my options menu…with an id of action settings.…I'll do everything else in this demonstration.…I'll create a new preferences XML file.…These go in a resource directory named XML.…I'll create a new resource directory…and set the resource type to XML,…the default directory name is XML and click okay.…
Then I'll go to that new directory and I'll create…
- Modeling data in POJO classes
- Customizing a ListView item display
- Displaying data in a RecyclerView
- Creating a custom array adapter
- Managing shared preferences with Java
- Creating and importing JSON data files
- Accessing SQLite from the command line
- Retrieving data with SQLite queries
Skill Level Intermediate
Android App Development: Data Persistence Librarieswith Annyce Davis3h 59m Intermediate
Android App Development: RESTful Web Serviceswith David Gassner2h 49m Intermediate
1. Display Static Data
2. Store Data in Shared Preferences
About shared preferences4m 41s
3. Store Data in Text Files
4. Manage Relational Data with SQLite
Next steps1m 43s
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.