09 Prepare : Reading
Storing User Preferences
Objectives
Understand how Android stores User Preferences.
Understand how to store custom classes.
Introduction
Before meeting with your team for your team activity, please read the following information:
-
Read about how Android uses Shared Preferences to store data between application launches.
-
Read this StackOverflow question about getSharedPreferences vs getDefaultSharedPreferences.
-
Review the Activity Lifecycle guide, and read about the kinds of things you should do in the onPause and onStop callbacks.
-
Read this StackOverflow post about how to use GSON to serialize a custom class into shared preferences. (Note they use preferences rather than shared preferences, which probably isn't what you want).
Reading Quiz
Don't forget to take the Reading Quiz in I-Learn. This quiz can be taken as many times as you like, but you must score at least 90% to pass. If you fail the quiz, review the relevant parts of the reading and try again.
As before, one of the quiz questions is a "deep thought" question whose answer won't come directly from the reading.