开发者

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

开发者 https://www.devze.com 2023-03-16 06:06 出处:网络
开发者_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.

开发者_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.

0

精彩评论

暂无评论...
验证码 换一张
取 消