Help sort to list by date
I have an array list sorted from oldest to newest. I want to change it so that it is sorted from newes开发者_高级运维t to oldest. Can anyone help me?
Sounds like you want to reverse the order of an array?
Collections.reverse(yourSortedList);
See Android docs
This is just a java question rather than Android:
ArrayList<String> originalList = new ArrayList<String>();
ArrayList<String> newList = new ArrayList<String>();
for(int i = originalList.size(); i > 0 ; i--) {
newList.add(originalList.get(i));
}
I'm sure there are other ways that differ that can be discussed.
精彩评论