I’ve been working on a phone app using Froyo (my phone version). I would like to switch to include Honeycomb in the project.
I’ve imported the Android Compatibility Package into my project. My current app reads from a SQLite database. Loads a Gallery and various GridViews and ListViews from said database. I don’t know what to do next. Do I switch Activities to FragmentActivities? How do I go from my current Cursors to CursorLoaders? How does that affect the Custom Adapters I have for loading the gallery and grid/list views? Etc…
I’d appreciate any help and advice you can give. I’m having trouble just grasping how to convert what I have and to allow both to coexist. I really want to do it “the right way”.
EDIT: I realize this is a rather broad “question”. So, let’s concentrate on the Cursor to CursorLoader thing. I’ll create new questions for the other items.
Are you wanting your app to run on both Froyo and Honeycomb? Or switch to Honeycomb only?
If you’re only interested in running on Honeycomb devices, you simply need to replace all of your deprecated method calls (
Activity.managedQuery()) with their Honeycomb replacements (CursorLoader).If you want to run on both versions of Android (or earlier), then you can use reflection. Basically reflection tests if a particular method or class (for example, CursorLoader) is available on the current system, and allows you to decide what to do in each case. Here is a tutorial regarding reflection: http://mobile.tutsplus.com/tutorials/android/java-reflection/
OR, you can simply use the deprecated methods as normal and they should run properly on Honeycomb. Check here for further information about maximizing app compatibility with Honeycomb, including making sure the app fills the screen, and allowing use of the Action bar.