I'm saving details of product in a map and adding in ArrayList< HashMap< String,String >> and setting in to a custom list adapter. I need to sort the values by price in it. How to achieve it? Thanks in advance.
Pleas use the code below :
ArrayList< HashMap< String,String >> arrayList=populateArrayList();
    Collections.sort(arrayList, new Comparator<HashMap< String,String >>() {
        @Override
        public int compare(HashMap<String, String> lhs,
                HashMap<String, String> rhs) {
            // Do your comparison logic here and retrn accordingly.
            return 0;
        }
    });
                        If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With