I've been going through the exercises in this book and for the most part I've had few problems. The earthquake example has been interesting but now it is confounding me. At some point in the book (chapter 6) we added preference options to the application and they worked fine. Then this was put to one side as through the next few chapters we worked on adding other functionality. By chapter 9 we start moving various things into the service class and from here on selecting the preference option causes the application to crash and a 'force close' message to be displayed.
There are a couple of lines of code that have dissapeared in the downloadable source code, despite not being told to in the book. For example the line
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getA pplicationContext());
in the onCreate method of the Earthquake class has vanished. Is this intentional? Also the variable 'minimumMagnitude' in the EarthquakeService class doesn't seem to do anything.
I understand that the author wasn't focusing on the preferences in these later chapters, but it is a pity he didn't test to make sure the preferences feature still worked throughout the later examples.
Has anyone else come across this? What do I need to do to make the preferences work again?