AdapterContextMenuInfo.id [英] AdapterContextMenuInfo.id
问题描述
我在网上看这个问题。所以,我的理解是,AdapterContextMenuInfo.position是ListView中的项目的索引。
时AdapterContextMenuInfo.id在光标或在数据库中的项目的主密钥ID的项的索引?我已经用它在数据库中的项目的主密钥ID。是游标按主键索引?
时AdapterContextMenuInfo.id在光标或在数据库中的项目的主密钥ID的项的索引?
块引用>这是
_id
列,它是你的光标
,里面当您使用<价值code>的CursorAdapter 。
按主键索引游标?
块引用>
光标
不被索引,期。但是,要使用的CursorAdapter
,您必须在其名称<$的光标
的结果集中的列C $ C> _id 。I have looked online about this. So my understanding is that AdapterContextMenuInfo.position is the index of the item in the listview.
Is AdapterContextMenuInfo.id the index of the item in the Cursor or the primary key id of the item in the database? I have used it as the primary key id of the item in the database. Are cursors indexed by primary key?
解决方案Is AdapterContextMenuInfo.id the index of the item in the Cursor or the primary key id of the item in the database?
It is the value of the
_id
column that is inside yourCursor
, when you are using aCursorAdapter
.Are cursors indexed by primary key?
Cursors
are not indexed, period. However, to useCursorAdapter
, you must have a column in theCursor
's result set that has the name_id
.这篇关于AdapterContextMenuInfo.id的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!