January 2014
Intermediate to advanced
736 pages
70h 43m
English
The preferenceChangeListener (Fig. 5.23) is an anonymous-inner-class object that implements the OnSharedPreferenceChangeListener interface. This object was registered in method onCreate to listen for changes to the app’s SharedPreferences. When a change occurs, method onSharedPreferenceChanged sets preferencesChanged to true (line 120), then gets a reference to the QuizFragment (lines 122–123) so that the quiz can be reset with the new preferences. If the CHOICES preference changed, lines 127–128 call the QuizFragment’s updateGuessRows and resetQuiz methods.
111 // listener for changes to the app's SharedPreferences112 private ...
Read now
Unlock full access