[Solved] High Score in Android [closed]


Like Tobiel said if your data is stored in your database a query will be much better. However, if you need to do it in code you should modify your Collection sort.

If in your scoreList you have a collection of Score objects you can compare their scores like this:

    Collections.sort(scoreList, new Comparator<Score>() {
        @Override
        public int compare(Score score1, Score score2){
            if(score1.getScore() < score2.getScore())
                return -1;
            else if(score1.getScore() > score2.getScore())
                return 1;
            else
                return 0;
        }
    });

Then when you execute your for loop they will be organized by the highest scores.

1

solved High Score in Android [closed]