0

I have custom ListView in my android application. It consists images and title and content like subtitle and price. Here I want to sort my ListView in price basis. Any one can help me? How to sort the ListView. For example pls refer the following link if possible to sort the list in degree basis...

http://www.codeproject.com/Articles/507651/Customized-Android-ListView-with-Image-and-Text

2 Answers 2

1

You need to sort the data structure before setting in the listview. it is only the possible way i think

Sign up to request clarification or add additional context in comments.

Comments

1

First sort your data like this

Collections.sort(myList, new Comparator<WeatherData>() {

        @Override
        public int compare(WeatherData lhs, WeatherData rhs) {

            return lhs.degree.compareTo(rhs.degree);
        }
    });

and then apply it to your adapter.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.