更新时间:2022-06-01 02:39:12
在 onItemClick(AdapterView<?>父级中使用
的 CursorAdapter
时,查看视图,int位置,长id) AdapterView.OnItemClickListener
实现,您可以获得:
When you are working with CursorAdapter
in onItemClick(AdapterView<?> parent, View view, int position, long id)
implementation of AdapterView.OnItemClickListener
you can get:
_id
列-简单来说,它是此函数的 long id
参数在项目视图中可见或不可见但存在于Cursor中的任何列,方法是将项目投射到Cursor的位置,例如:
_id
column from the underlying Cursor - simply, it is the long id
parameter of this functionany column visible or not in your item view but existing in the Cursor by casting the item at position to the Cursor like:
光标c =(光标)parent.getItemAtPosition(位置);
现在 c
指向选定的行,因此您可以从中获取任何列,就像 var value = c.getInt/String/etc(c.getColumnIndex("columnname));
Now c
is pointing to the selected row so you are can get any column from it as simple as var value = c.getInt/String/etc(c.getColumnIndex("columnname"));