I have a following method where i read data from Android shared preferences, and I am wondering if there is a way to sort the map by value when the entry values are <String,capture<?>>
. I am writing to shared preferences with putString("name",int score)
.
public String readScores(){
String returnString = "";
int iterator = 1;
SharedPreferences shared = getSharedPreferences("highscores", MODE_PRIVATE);
Map<String, ?> values = shared.getAll();
for (Map.Entry<String, ?> entry : values.entrySet())
{
returnString += "<tr><td>" + String.valueOf(iterator) + "</td><td>" + entry.getKey() + "</td><td>" + String.valueOf(entry.getValue()) + "</td></tr>";
iterator++;
}
return returnString;
}