安卓报错 column '_id' does not exist 的解决
来源:互联网 发布:淘宝老a的店铺 编辑:程序博客网 时间:2024/05/01 00:10
在安卓开发过程中需要一个简单的搜索功能,搜索过程需要根据输入的字符,从数据库中选出可能匹配的项,先显示出来。
使用 SimpleCursorAdapter 来实现动态显示列表的功能
SimpleCursorAdapter mAdapter;Cursor cursor;cursor = database.query("Notes",new String[] {"id as _id","pictureName","contentName"},null,null,null,null,null);mAdapter = new SimpleCursorAdapter(this,android.R.layout.simple_list_item_1,cursor,new String[] {"contentName","pictureName"}, new int[] { android.R.id.text1 }, 0);
注意 id as _id。
使用SimpleCursorAdapter 需要数据库的表中有名为 _id 的列,可以手动去修改原来数据库的表,增加_id 列。若已经有类似 id 的自增的列,那么可以在查询时,加入 “ id as _id”
0 0
- 安卓报错 column '_id' does not exist 的解决
- column '_id' does not exist
- column '_id' does not exist
- 一夜的错误 : simpleCursorAdapter column '_id' does not exist
- java.lang.IllegalArgumentException: column '_id' does not exist 的相关
- android – 报错column ‘_id’ does not exist的解决
- android – 报错column ‘_id’ does not exist的解决
- SimpleCursorAdapter知识点关于一个: (IllegalArgumentException: column '_id' does not exist)_id字段的异常
- java.lang.IllegalArgumentException: column '_id' does not exist
- java.lang.IllegalArgumentException: column '_id' does not exist
- simplecursoradapter使用时提示column '_id' does not exist
- android——错误:column ‘_id’ does not exist
- java.lang.IllegalArgumentException: column '_id' does not exist
- java.lang.IllegalArgumentException: column '_id' does not exist
- Android 异常 -1 column '_id' does not exist
- java.lang.IllegalArgumentException: column '_id' does not exist
- java.lang.IllegalArgumentException: column '_id' does not exist 解决方法
- 关于使用CursorAdapter()时出现“column '_id' does not exist”错误的说明及解决方案
- 软件工程之基础篇
- PHP之——自动类型转换
- CoreData 实体之间的关系
- SDWebImage缓存图片的机制
- 解决输出中文乱码问题
- 安卓报错 column '_id' does not exist 的解决
- java关键字——static
- rn_xtcxyczjh-4 整理2[改良宏 重写双向链表接口 自动测试程序(assert)]
- 从SQL server数据库取数据显示到Net Beans界面上
- leetcode007 Reverse Integer
- A Bug's Life 并查集
- Construct Binary Tree from Inorder and Postorder Traversal
- linux下C语言UDP通信
- 策略模式的小例子