I was searching for a while but i couldn't find the solution.
Situation:
I'm using a ListView
and I have in a Cursor
the result of a SQLiteDatabase.query.
If I use a
SimpleCursorAdapter
, when you callonItemClick(AdapterView<?> parent, View view, int position, long id)
, theid
returned is the_id
of the row of the given Cursorbut if I use a custom Adapter the return id works like an array [0,1,2,3], how can I set in the custom Adapter this i开发者_运维技巧d?
Thanks
Adapter has a method that you can override, called getItemId(int pos)
.
Just return whatever id you need for a given item position and it will be passed to you on the item click.
精彩评论