Search code examples
androidandroid-contentprovider

Set contentresolver sort order to sort case-insensitively


I'm making a contentresolver query to fetch all Songs. I'm setting the sort order to be String sortOrder = MediaStore.Audio.Media.TITLE + " ASC";

The problem with this sort order is it returns all starting with capital letter first (from A-Z) then with small letters. I want to sort case-insensitively. Ex- I want the result to be like (A, a, B, b, E, f, H) instead of (A, B, E, H, a, b, f)

How can I achieve this in contentResolver query?


Solution

  • You can try

    sortOrder = MediaStore.Audio.Media.TITLE + " COLLATE NOCASE ASC";