Android异常总结---E/AndroidRuntime(23439): Caused by: java.lang.IllegalArgumentException: column '_id' d
2014-11-10 12:01
661 查看
1.在使用SimpleCursorAdapter adapter=new SimpleCursorAdapter
(this,R.layout.item,cursor,new String[]{"name","phone","amount"},new int[]
{R.id.name,R.id.phone,R.id.amount});这个SimpleCursorAdapter适配器的时候:
出现这个异常:
-----------------------------------------------
03-12 23:23:22.934: E/AndroidRuntime(23439): Caused by:
java.lang.IllegalArgumentException: column '_id' does not exist
--------------------------------------------------------------------
这个异常跟SimpleCursorAdapter ,这个源码有关:
可以查看源码,会有说明:
---------------------------
方法:1.把数据库表中的主键id改成:_id
2.处理查询后的结果集:主键起一个别名:
select personid as _id,name,phone,amount from person order by personid asc
limit ?,?
转自:http://blog.csdn.net/lidew521/article/details/8666307
(this,R.layout.item,cursor,new String[]{"name","phone","amount"},new int[]
{R.id.name,R.id.phone,R.id.amount});这个SimpleCursorAdapter适配器的时候:
出现这个异常:
-----------------------------------------------
03-12 23:23:22.934: E/AndroidRuntime(23439): Caused by:
java.lang.IllegalArgumentException: column '_id' does not exist
--------------------------------------------------------------------
这个异常跟SimpleCursorAdapter ,这个源码有关:
可以查看源码,会有说明:
---------------------------
方法:1.把数据库表中的主键id改成:_id
2.处理查询后的结果集:主键起一个别名:
select personid as _id,name,phone,amount from person order by personid asc
limit ?,?
转自:http://blog.csdn.net/lidew521/article/details/8666307
相关文章推荐
- Android异常总结---E/AndroidRuntime(23439): Caused by: java.lang.IllegalArgumentException: column '_id' d
- Android错误总结-E/AndroidRuntime(23439): Caused by: java.lang.IllegalArgumentException: column 'id' d
- Android Caused by: java.lang.IllegalArgumentException: column '_id' does not exist
- Android Caused by: java.lang.IllegalArgumentException: column '_id' does not exist
- Android Caused by: java.lang.IllegalArgumentException: column '_id' does not exist
- Caused by: java.lang.IllegalArgumentException: addChild: Child name 'localhost' is not unique
- Android学习----异常(3)---java.lang.IllegalArgumentException: column '_id' does not exist
- java.lang.IllegalArgumentException: column '_id' does not exist 的相关
- java.lang.IllegalArgumentException: column '_id' does not exist
- AndroidStudio启动异常:Caused by: java.lang.IllegalArgumentException: Argument for @NotNull paramet
- java.lang.IllegalArgumentException: column '_id' does not exist
- java.lang.IllegalArgumentException: column '_id' does not exist
- java.lang.IllegalArgumentException: column '_id' does not exist
- java.lang.IllegalArgumentException: column '_id' does not exist
- java.lang.IllegalArgumentException: column 'xxx' does not exist解决方法
- Tomcat8.0部署web发生Caused by: java.lang.IllegalArgumentException: Invalid <url-pattern> /*.do in servle
- Android Caused by: java.lang.IllegalArgumentException: column '_id' does not exist
- android小问题-------------SimpleCursorAdapter使用时的问题。 java.lang.IllegalArgumentException: column '_id' d
- Android广播接收器注册问题:Caused by: java.lang.IllegalArgumentException: Receiver not registered
- android java.lang.IllegalArgumentException: column 'id' does not exist 错误