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!
source
share