0

How to get a list of songs using mediastore in alphabetical order. I get all songs using mediastore in an arraylist but this is not in alphabetical order how to get it or how to sort arraylist in alphabetical order

Kunal Puri
  • 185
  • 1
  • 9
  • http://stackoverflow.com/questions/5815423/sorting-arraylist-in-alphabetical-order-case-insensitive refer this to sort arraylist of your songs – Muhib Pirani Apr 15 '17 at 13:29

1 Answers1

2

You should sort at source, ie when you execute the query. The last parameter is the one to specify your sort. For example:

sort_order = AudioColumns.ARTIST + " DESC, "
                    + AudioColumns.TRACK + " DESC";


context.getContentResolver().query(MediaStore.Audio.Media.EXTERNAL_CONTENT_URI,
                        dataColumns,
                        selection, selectionArgs,
                        sort_order);
Theo
  • 2,012
  • 1
  • 16
  • 29