Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to get the unique id of an item in listview created using simpleadapter in onListItemClick
    primarykey
    data
    text
    <p>After searching lot of similar questions posted on stackoverflow and other forums for couple of days I decided to post this since I couldn't find the answer I was looking for (I might have missed the obvious).</p> <p>Let us say I have a arraylist of hashmaps which in turn contains 2 items , 1 - a unique ID which was retrieved from a database table and 2 - name of a country. </p> <p>I have defined my listview in a layout xml, and also have a separate layout with the country name as a text view in it. I have an activity class which extends listactivity for which I have set the contentview as the layout which contains the listview layout.</p> <p>I have created a simpleadapter using this hashmap and with the countryname field name (I want only the country name to be displayed in the list view) - view comes up fine, no issues there.</p> <p>Now when then an item on the view is clicked the onListItemClick method gets called as expected and I'm able to retreive the countryname based on the position. But what I actually want to get is the ID of the country which was originally stored in the arraylist(hashmap) but was not included in the list of items to be displayed in the listview. Is there any way to get that ID? When I use a cursor adapter, the same onlistitemclick is able to give me the uniqueID of the data in the ID parameter, but when I use a simpleadapter the id passed on the call back seems to be same as the position. </p> <p>Any lead on this is highly appreciated, it is quiet possible I might have missed the obvious.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload