A simple cursor adapter requires a minimum of api 11 issue

I am working on an application in which I need to populate a list view from a database. I get a compatibility issue in the following code

dataAdapter = new SimpleCursorAdapter( this, R.layout.eventlisting, cursor, columns, to, 0); 

Requires a minimum level of api 11, mine is 8. Is there an alternative for this to work on api 8. Can I use the support library?

+4
source share
2 answers

Try SimpleCursorAdapter from the support class . It is used as API version 11+ and it is already backward compatible.

You need to download the support library, so you only need to change the import Like This way

 import android.support.v4.widget.SimpleCursorAdapter; 
+10
source

For backword compatibility, you can download the support library and make your code workable.

add support library

Right click on your project -> Android Tools -> add a support library.

then again

Right click on your project -> Android Tools -> fix project properties.

and then clean your project build. After that, you can import the SimpleCursorAdapter class into your application.hope, this will help.

0
source

All Articles