Search code examples
androidlistviewsortedlist

Android sorted listview question


I am having a bit of trouble with android. I have a sorted listview of items retrieved from a database.

This is where I run into the problem. How do you get the actual database row id of the item based upon the listview? I can't use the position of the list view due to it being sorted. Is there a way to retrieve it from CursorAdapter?

Thank you,


Solution

  • Have you tried

    Adapter.getItemId(int position);
    

    See the description in the Android docs.