Iterator it = Names.keySet().iterator();
List<KeyAndValue> tempList = new ArrayList<SystemDBHelper.KeyAndValue>();
while(it.hasNext()){
@SuppressWarnings("unchecked")
Map.Entry<String, Integer> key =(Entry<String, Integer>) it.next();
tempList.add(new KeyAndValue(key.getKey(), key.getValue()));
LogManager.e("key "+key.getKey() +" value "+key.getValue());
}
java.util.Collections.sort(tempList, new Comparator<KeyAndValue>() {
@Override
public int compare(KeyAndValue object1, KeyAndValue object2) {
// TODO Auto-generated method stub
if (object1.value > object2.value) {
return -1;
} else if (object1.value< object2.value) {
return 1;
}
return 0;
}
});