search

Home  >  Q&A  >  body text

java - android如何获得mp3音乐的本地专辑图片

部分代码如下

private static final Uri albumArtUri = Uri
            .parse("content://media/external/audio/albumart")
long albumId = cursor.getLong(
                    cursor.getColumnIndex(MediaStore.Audio.Media.ALBUM_ID));
Uri uri = ContentUris.withAppendedId(albumArtUri, album_id);

使用这个方法获得的是空的专辑图片,
同样,根据songidUri.parse("content://media/external/audio/media/"+ songid + "/albumart");也无法获得
是不是现在的MP3的专辑图片的信息不存储在数据库中了?

巴扎黑巴扎黑2889 days ago567

reply all(2)I'll reply

  • 巴扎黑

    巴扎黑2017-04-17 17:54:48

    It seems that your method requires the support of the system's MediaScanner service.
    It is recommended to get the album cover you want directly from the file. This data is stored in the ID3 information of the MP3 file.
    You can check out this library: https: //github.com/mpatric/mp3agic

    reply
    0
  • PHP中文网

    PHP中文网2017-04-17 17:54:48

    I also encountered such a problem, how did the original poster solve it?

    reply
    0
  • Cancelreply