Join David Gassner for an in-depth discussion in this video Listening for changes to shared preferences, part of Android App Development: Local Data Storage (2013).
There are many scenarios in an Android application where you need to instantly…react when a preference is changed and update the user interface in some way.…When you need to this, you can create a preference listener, an event listener…that will let you know when a preference has been updated and let you add code…that executes when that happens.…I'll work in a new version of the project called PreferenceListener.…Just as in the last video, this version of the project has buttons to set and…show preferences, but I'll update this version of the application so that the…preferences are updated instantly when they're changed at runtime.…
I'll go to the application's MainActivity Java class, and I'll start by creating…an instance of a listener object.…I'll declare the listener object as a field of the class, so that it persists as…long as the activity is on the screen.…You'll see that developers sometimes create this listener objects within…an onCreate Method.…The problem with that, though, is that they're weakly referenced and subject to…
- Exploring local data storage options
- Creating an Android virtual device
- Starting a new project
- Defining preferences with Java and activities
- Creating and reading JSON and XML data files
- Creating a new SQLite database
- Inserting and retrieving data in the database
Skill Level Intermediate
1. Getting Started
2. Using Application Preferences
3. Using Internal and External File Storage
4. Working with SQLite Databases
5. Managing and Displaying SQLite Data
Improving the data display9m 29s
- 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.