Reputation: 4522
I can't get the albumID from MediaStore, i get -1 from getColumnIndex
. Here is my code:
Cursor cursor = mContext.getContentResolver().query(MediaStore.Audio.Albums.EXTERNAL_CONTENT_URI,
null, null, null, null);
if (cursor.moveToFirst() == false)
{
//no rows empty cursor
}
int albumColumnIndex = cursor.getColumnIndex(Audio.Albums.ALBUM);
int albumidColumnIndex = cursor.getColumnIndex(Audio.Albums.ALBUM_ID);
String album = cursor.getString(albumColumnIndex);
int id = cursor.getInt(albumidColumnIndex);
while(cursor.moveToNext())
{
album = cursor.getString(albumColumnIndex);
id = cursor.getInt(albumidColumnIndex);
}
For some reason getColumnIndex(Audio.Albums.ALBUM_ID);
returns -1, does anyone know why could that be? Album name works fine.
Upvotes: 2
Views: 1919
Reputation: 4522
Apparently _ID
is ALBUM_ID
for MediaStore.Audio.Albums.ALBUM_ID
. Docs for MediaStore are really bad.
Upvotes: 12