Android playlist request is inaccurate ...?

this seemingly simple problem baffles me. I have the following code:

Cursor c = getContentResolver().query(
            MediaStore.Audio.Playlists.EXTERNAL_CONTENT_URI,
            new String[] {MediaStore.Audio.Playlists._ID, MediaStore.Audio.Playlists.NAME},
            null,
            null,
            MediaStore.Audio.Playlists.DEFAULT_SORT_ORDER);

    c.moveToFirst();
    Log.d("TestTest", String.format("Count is %d", c.getCount()));
    for (int i = 0; i < c.getCount(); i++) {
        c.moveToPosition(i);
        int id = c.getInt(c.getColumnIndex(MediaStore.Audio.Playlists._ID));
        String s = c.getString(c.getColumnIndex(MediaStore.Audio.Playlists.NAME));
        Log.d("TestTest", "HEY!  " + s + "  " + String.format("%d", id));
    }

The number is reported as 1, and apparently my only playlist is called the “m3u playlist”.

What's going on here? I have several playlists and just want to print a list of them.

Thanks for all the answers!

+3
source share
1 answer

Well, it took me a long time to realize that playlists created in the Music Player app are not included in MediaStore.Audio.Playlists ....

But I realized that now.

+2
source

Source: https://habr.com/ru/post/1793199/


All Articles