开发者

Using Loader em API version prior to 11

I am using a Curso开发者_运维知识库rAdapter and ContentProvider, and I want to use CursorLoader, so I reconfigured my project to target API 11 and set min-sdk-ver to 7. However it crashes when an Activity calls a sub-Activity which uses the CursorLoader. The error is NoClassDefFoundError delivered via IllegalStateException.

My question is can we use Honeycomb APIs in previous Android versions even if we have the same configs a have?


If you wish to use CursorLoader in an Android application supporting pre-API Level 11 devices, you will need to use the Android Compatibility Library (ACL). You can download that via the SDK and AVD Manager and copy the JAR from your SDK installation into your project. Then, you will need to use support.v4 versions of the loader classes, plus inherit from FragmentActivity, so you can call getSupportLoaderManager() to get your ACL edition of the LoaderManager.

This blog post describes (briefly) the ACL. A sample app using CursorLoader is found packaged with the ACL itself. You can also review a tutorial on using ACL's edition of CursorLoader.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜