I am trying to understand something, and I am sure it is very basic to some people.
I read everywhere that the startManagingCursor method is deprecated and you should use the CursorLoader class. But does that mean that you should use the CursorLoader class even for apps that support API levels < 11? Or is it saying that if you intend to only support Honeycomb and up, THEN use cursorLoader?
I don't appear to be able to import the cursor loader class with api 4, so i assume that using CursorLoader doesn't apply until Android 3.0+, but can someone verify for me please?
Thanks
If you are willing to inherit from
FragmentActivity
, you can use theLoader
framework implementation in the Android Support package, going all the way back to Android 1.6.That being said, "deprecated" in Android usually means "we will continue to support this, but we think there are better solutions". You can certainly use
startManagingCursor()
on API Level 11+. However, the problems with managed cursors (notably that theyrequery()
on an activity restart on the main application thread) are still there, on older and newer Android versions.You certainly can, and, all else being equal, you probably should. However, all else is rarely equal, and the
FragmentActivity
requirement may be a problem for you.If you are developing a new application, today, you should be thinking about fragments from the outset, in which case you would be using
FragmentActivity
anyway, and therefore usingLoader
should not be a problem.The Android Support package implementation of
Loader
works on API Level 4 and above.