Android’s PreferenceActivity for all API versions

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

Android app shortcuts and class names

I recently learned the hard way that refactoring your old code to be more consistent with how you write code now as opposed to how you wrote it a year ago can be dangerous. Things like class names may seem like a completely internal mechanism and is in most cases, but the rule for that changes the moment you place one into the AndroidManifest.xml. Continue reading

Android: Always create a Launcher activity!

ALWAYS CREATE A LAUNCHER ACTIVITY!

I cannot stress that enough. When I created AttachSave, I designed it with the intention that it would be a small, hidden app that did not clutter up the launcher tray with useless apps that couldn’t be run traditionally anyway. Despite warnings from others posted elsewhere, I thought making the description quite clear on how to use the app would be sufficient to teach people on how to use the app. Continue reading