How can I update the album art path using contentResolver?

Posted by Ungureanu Liviu on Stack Overflow See other posts from Stack Overflow or by Ungureanu Liviu
Published on 2010-03-24T01:10:37Z Indexed on 2010/03/24 1:13 UTC
Read the original article Hit count: 628

Filed under:
|

Hi! I want to update/insert a new image for an album in MediaStore but i can't get it work..

This is my code: public void updateAlbumImage(String path, int albumID) {

    ContentValues values = new ContentValues();
    values.put(MediaStore.Audio.Albums.ALBUM_ART, path);

    int n = contentResolver.update(MediaStore.Audio.Albums.EXTERNAL_CONTENT_URI, values, MediaStore.Audio.Albums.ALBUM_ID + "=" + albumID, null);
    Log.e(TAG, "updateAlbumImage(" + path + ", " + albumID + "): " + n);
}

The error is: 03-24 03:09:46.323: ERROR/AndroidRuntime(5319): java.lang.UnsupportedOperationException: Unknown or unsupported URL: content://media/external/audio/albums 03-24 03:09:46.323: ERROR/AndroidRuntime(5319): at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:131) 03-24 03:09:46.323: ERROR/AndroidRuntime(5319): at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:111) 03-24 03:09:46.323: ERROR/AndroidRuntime(5319): at android.content.ContentProviderProxy.update(ContentProviderNative.java:405) 03-24 03:09:46.323: ERROR/AndroidRuntime(5319): at android.content.ContentResolver.update(ContentResolver.java:554) 03-24 03:09:46.323: ERROR/AndroidRuntime(5319): at com.liviu.app.smpp.managers.AudioManager.updateAlbumImage(AudioManager.java:563) 03-24 03:09:46.323: ERROR/AndroidRuntime(5319): at com.liviu.app.smpp.ShowAlbumsActivity.saveImageFile(ShowAlbumsActivity.java:375) 03-24 03:09:46.323: ERROR/AndroidRuntime(5319): at com.liviu.app.smpp.ShowAlbumsActivity.onClick(ShowAlbumsActivity.java:350)

Thank you!

© Stack Overflow or respective owner

Related posts about android

Related posts about android-sdk