Question

this seemingly simple issue is confusing 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 count is being reported as 1, and the apparently my only playlist is named 'm3u playlist'.

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

Thanks for all answers!

Was it helpful?

Solution

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

But I get it now.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top