简单的游标适配器需要最少的api 11问题 [英] simple cursor adapter requires minimum api 11 issue
问题描述
我正在开发一个app,我需要在其中填充数据库中的列表视图.我在以下代码中遇到兼容性问题
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);
它要求最小api级别为11,我的是8.是否有其他选择可以使此代码也可以在api 8上运行.我可以使用支持库吗?
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?
推荐答案
尝试支持类中的SimpleCursorAdapter .它的使用方式类似于API 11+版本,并且已经向后兼容.
Try the SimpleCursorAdapter from the support class. It is used like the API 11+ version and it is already backwards compatible.
您必须下载Support Library,因此您只需要更改导入,就像这样 :
You have to download the Support Library , so you only need to change the import Like This way :
import android.support.v4.widget.SimpleCursorAdapter;
这篇关于简单的游标适配器需要最少的api 11问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!