I\'m using Sharkey\'s SeparatedListAdapter class in order to have a ListView that is separated by sections.
The class works great, but the problem I\'m having is in
For anyone else I too recently ran into this problem and ended up here, I solved by:
First altering the Map to take an 'id'
public Map createItem(String title, String caption, String id) {
Map item = new HashMap();
item.put(ITEM_TITLE, title);
item.put(ITEM_CAPTION, caption);
item.put("id", id); // Add a unique id to retrieve later
return item;}
Second when adding a section make sure to include an id:
List
Finally Use a Map in ItemClickListener to retrieve 'id' of the correct position:
@Override
public void onItemClick(AdapterView> arg0, View v, int position, long arg3) {
// TODO Auto-generated method stub
Map map = (Map) arg0.getItemAtPosition(position);
String UniqueId = map.get("id");
Log.i("Your Unique Id is", UniqueId);
//Can then use Uniqueid for whatever purpose
//or any other mapped data for that matter..eg..String FirstName = map.get("ITEM_TITLE");
}
Hope this helps someone.