I\'m using a list to populate a ListView (). The user is able to add items to the list. However, I need the items to be displayed at the top of the ListView. How do I insert
You could always have a datestamp in your objects and sort your listview based on that..
public class CustomComparator implements Comparator {
public int compare(YourObjectName o1, YourObjectName o2) {
return o1.getDate() > o2.getDate() // something like that.. google how to do a compare method on two dates
}
}
now sort your list
Collections.sort(YourList, new CustomComparator());
This should sort your list such that the newest item will go on top