问题
I am working on a app , in which i require to populate list view from the database. I am getting compatibility issue in following code
dataAdapter = new SimpleCursorAdapter(
this, R.layout.eventlisting,
cursor,
columns,
to,
0);
It requires min api level 11 , mine is 8. Is there any alternative for this to make this code work on api 8 as well. Can i use support library?
回答1:
Try the SimpleCursorAdapter from the support class. It is used like the API 11+ version and it is already backwards compatible.
You have to download the Support Library , so you only need to change the import Like This way :
import android.support.v4.widget.SimpleCursorAdapter;
回答2:
For Backword compatibility you can download support library and make your Code working.
to add support library
Right Click your Project -> android tools -> add support library.
then again
Right Click your Project -> android tools -> fix project properties.
and then clean build your project.after that you will be able to import SimpleCursorAdapter class in your application.hope it will help.
来源:https://stackoverflow.com/questions/14291006/simple-cursor-adapter-requires-minimum-api-11-issue