On Fri, Aug 6, 2010 at 5:38 PM, Bret Foreman <bret.fore...@gmail.com> wrote:
> One other consideration is what the next version of Android will do about > this. It's pretty clear that this is an important missing feature. I expect > they'll eventually make a version of getXXX that reads the default value > from preferences.xml if there's no key-value pair in the database yet, > and throws an exception if no default value is found. > I can't imagine this would change anytime soon, if at all. I've never found this to be that big of a deal personally. Granted, it's annoying when you have to change the default value, but my suggestion for using resources should solve that. > From that perspective, it makes more sense to put a wrapper around getXXX > and do my own parsing of the default values from preferences.xml. This > has the added advantage that addition and removal of new preference keys can > happen in the same file where the defaults are defined. And then when the > improved version of getXXX comes out, I can just remove the wrapper. > Those are big assumptions about what will or will not happen. > Does this code look right for getting at the raw xml data? > Seems like overkill. Assuming you're in Activity: InputStream is = getResources().openRawResource(R.xml.preferences); That's it. ------------------------------------------------------------------------------------------------- TreKing <http://sites.google.com/site/rezmobileapps/treking> - Chicago transit tracking app for Android-powered devices -- You received this message because you are subscribed to the Google Groups "Android Beginners" group. ATTENTION: Android-Beginners will be permanently disabled on August 9 2010. For more information about this change, please read [http://goo.gl/xkfl] or visit the Group home page. Try asking and tagging your question on Stack Overflow at http://stackoverflow.com/questions/tagged/android To unsubscribe from this group, send email to android-beginners+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en