SimpleCursorAdapter和_id
2011-10-24 00:13
323 查看
在使用simpleCursorAdapter显示sqlite数据时,在new创建阶段就出现 java.lang.IllegalArgumentException: column ‘_id’ does not exist 错误。
查询手册后,发现Cursor中未包含名为_id的列,而该要求是父类CursorAdapter的要求。
遇到这种情况,可以在查询语句中伪造一列名为_id的字段。
建议:sqlite的主键命名时,命名为_id,所以,当你用到sqlite的simpleCursorAdapter时,必须把数据表的主键命名为_id。
今天弄这个超不爽,后悔没有错了就上网查,搞的很久都没弄清楚,结果网上一查才知道这样。。。
原文地址:/article/5682735.html
查询手册后,发现Cursor中未包含名为_id的列,而该要求是父类CursorAdapter的要求。
遇到这种情况,可以在查询语句中伪造一列名为_id的字段。
建议:sqlite的主键命名时,命名为_id,所以,当你用到sqlite的simpleCursorAdapter时,必须把数据表的主键命名为_id。
今天弄这个超不爽,后悔没有错了就上网查,搞的很久都没弄清楚,结果网上一查才知道这样。。。
原文地址:/article/5682735.html
相关文章推荐
- android小问题-------------SimpleCursorAdapter使用时的问题。 java.lang.IllegalArgumentException: column '_id' d
- 使用 SimpleCursorAdapter 时java.lang.IllegalArgumentException: column '_id' does not exist问题
- android中SimpleCursorAdapter _id错误的问题
- SimpleCursorAdapter必须要一个_id字段
- SimpleCursorAdapter参数from必须包含_id字段的原因
- android中SimpleCursorAdapter _id错误的问题
- SimpleCursorAdapter和_id
- simplecursoradapter使用时提示column '_id' does not exist
- SimpleCursorAdapter与ListView的使用
- Android实现获取本机中所有图片(Loader,CursorLoader,LoaderManager,SimpleCursorAdapter的简单应用)
- ArrayAdapter ,SimpleAdapter ,SimpleCursorAdapter 区别
- 安卓:将数据库中的数据查询出来用adapter(SimpleAdapter,SimpleCursorAdapter,自定义适配器CursorAdapter)绑定到listview上
- 与数据库打交道的Adapter----SimpleCursorAdapter
- Android 3.0 r1 API中文文档(106) —— SimpleCursorAdapter
- ArrayAdapter SimpleAdapter SimpleCursorAdapter 区别
- ArrayAdapter ,SimpleAdapter ,SimpleCursorAdapter 区别
- Android SimpleCursorAdapter的使用
- Android API : SimpleCursorAdapter()
- 解决SimpleCursorAdapter不能自动更新的问题
- SimpleCursorTreeAdapter