I want to make my list in ascending order how can i do pragmatically. I tryed but not success.
CODE:
PhonebookAdapter adapter; // My Phonebook Adapter Class
final List<Phonebook> listOfPhonebook = new ArrayList<Phonebook>();
...
...
adapter = new PhonebookAdapter(this, listOfPhonebook);
list.setAdapter(adapter);
Try using
Collections.sort(list);You may need toimport java.util.Collections;For using custom properties for sorting you will have to implement
ComparatorExample:And for sorting you will have to:
Collections.sort(list, new CustomComparator());