Sorting a list with a checkbox column in android -


i have listview in android contains 4 columns in row. can sorted 2 columns (id, group) other 2 color status value , checkbox. rows being sorted using comparators id, group when called notify these values sorted color , checkbox not. there way sort list based on row?

added code id comparator:

public static class idcomparator implements comparator<myobject> {         @override         public int compare(myobject lhs, myobject rhs) {             if (lhs.getid() == null) {                 if (rhs.getid() == null) {                     //equal                     return 0;                 } else {                     //lhs <                     return -1;                 }             }             if (rhs.getid() == null) {                 //lhs >                 return 1;             }             //neither null             if (lhs.getid() < rhs.getid()) {                 return -1;             } else if (lhs.getid() > rhs.getid()) {                 return 1;             } else {                 return 0;             }         }     } 

this method called here:

 collections.sort(mylist, idcomparator); 

i using collection.sort sorting in project :

 collections.sort(headerlist, new comparator<headervo>() {         @override         public int compare(headervo e1, headervo e2) {               return double.valueof(e2.getpno()).compareto(double.valueof(e1.getpno()));         } }); 

Comments

Popular posts from this blog

python - pip install -U PySide error -

arrays - C++ error: a brace-enclosed initializer is not allowed here before ‘{’ token -

cytoscape.js - How to add nodes to Dagre layout with Cytoscape -