Ama
Ama

Reputation: 195

Link Id from data in database, to custom ArrayAdapter, to listView

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?

Upvotes: 0

Views: 719

Answers (1)

Erich Douglass
Erich Douglass

Reputation: 52002

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.

Upvotes: 2

Related Questions