AdapterContextMenuInfo.id [英] AdapterContextMenuInfo.id

查看:88
本文介绍了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 your Cursor, when you are using a CursorAdapter.

Are cursors indexed by primary key?

Cursors are not indexed, period. However, to use CursorAdapter, you must have a column in the Cursor's result set that has the name _id.

这篇关于AdapterContextMenuInfo.id的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆