Most robust way to fetch album art in Android

后端 未结 4 1371
没有蜡笔的小新
没有蜡笔的小新 2020-12-09 23:24

Please note that I have already been through similar questions and their answers here and on other websites. I also have a solution that works on some devices (my G2X runnin

4条回答
  •  一向
    一向 (楼主)
    2020-12-10 00:06

    Uri sArtworkUri = Uri.parse("content://media/external/audio/albumart");
    Uri uri = ContentUris.withAppendedId(sArtworkUri, album_id);
    ContentResolver res = context.getContentResolver();
    InputStream in = res.openInputStream(uri);
    Bitmap artwork = BitmapFactory.decodeStream(in);
    

    More complete sample code can be found in Android Music player source here https://github.com/android/platform_packages_apps_music/blob/master/src/com/android/music/MusicUtils.java method getArtworkQuick.

提交回复
热议问题