I have spent the last few days learning about how to use the new Android PreferenceFragment which requires PreferenceActivity to override a new v11 (Honeycomb) method called onBuildHeaders(). Unfortunately, the documentation is not very clear how one would create a single PreferenceActivity that could play well in all versions, utilizing the newest features if you have it and avoiding an app crash on older Android versions. I encountered several solutions to this issue by creating two different activities for the two different mechanisms requiring two entries in your AndroidManifest.xml file. Having two different PreferenceActivities means if you have library code that extends that class, you now have to duplicate it. Then, if your app descends your library class, now has to be duplicated yet again. The end result is … less than ideal. Continue reading
A useful debugging tool, especially if you have several emulators in various states like I do, is to list all the phone settings that are stored in Settings.System and Settings.Secure as well as their current values.
$ adb shell #sqlite3 /data/data/com.android.providers.settings/databases/settings.db sqlite> select * from system; sqlite> select * from secure;
Settings that once were in System migrate to Secure as Android versions get released, so it is sometimes handy to know exactly what state the phone is in while you’re debugging on it.