Skip to content Skip to sidebar Skip to footer

Sorting Double Data (distance) On Listview

I've problem about sorting data from listview. I search in here and found about sorting String data. I need to sort Double data from my listView, I've same problem like this Androi

Solution 1:

I think you just need to parse the value you get out of the map, instead of parsing the input. Update your compare like this:

@Override
public int compare(HashMap<String, String> o1,
                    HashMap<String, String> o2) {
    return Double.compare(Double.parseDouble(o1.get(TAG_DISTANCE)), Double.parseDouble(o2.get(TAG_DISTANCE)));
} 

Post a Comment for "Sorting Double Data (distance) On Listview"