Android异常总结---E/AndroidRuntime(23439): Caused by: java.lang.IllegalArgumentException: column '_id' d
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 ?,?
补充:移动开发 , Android ,