Link Id from data in database, to custom ArrayAdapter, to listView
开发者_StackOverflow社区I am creating a custom listview.
The data is not coming from a cursor but from an ArrayAdapter
of my own class, which contains data coming from a cursor.
I've managed to create the custom list view, but when implement the onListItemClick
method, then I get an id for that row, that is not the same id for that data in the database.
How do I link the _id of the items in my database into my list, using my custom ArrayAdapter
?
Have your custom ArrayAdapter
implement getItemId(int position)
using the data from the cursor's _id column. Once you've done that, it should be provided to you as the id
argument to onListItemClick
.
精彩评论