Android API 28 GetBitMap投掷“没有这样的专栏”错误
在Android API 28上,我正在尝试使用专辑ID为特定专辑的专辑艺术。该代码在getBitMap上丢弃以下
android.database.sqlite.SQLiteException: no such column: _data (code 1 SQLITE_ERROR): , while compiling: SELECT _data FROM album_info WHERE (id=?)
代码:
Uri imageUri_t = ContentUris.withAppendedId(MediaStore.Audio.Albums.EXTERNAL_CONTENT_URI, albumID);
origImage = MediaStore.Images.Media.getBitmap(contentResolver, imageUri_t);
使用光标查询以获取MediaStore.audio.audiocolumns.album_id列以前收集了专辑ID。我还尝试了MediaStore.audio.albums_id,但同样的结果也会发生。
值得注意的是,它使用API 29中引入的较新的LoadThumnAil在API 29和30中正常工作
origImage = contentResolver.loadThumbnail(imageUri_t, new android.util.Size(256, 256), null);
On Android API 28, I'm trying to get the album art for a particular album using the albumID. The code throws the following error on getBitmap
android.database.sqlite.SQLiteException: no such column: _data (code 1 SQLITE_ERROR): , while compiling: SELECT _data FROM album_info WHERE (id=?)
The code below:
Uri imageUri_t = ContentUris.withAppendedId(MediaStore.Audio.Albums.EXTERNAL_CONTENT_URI, albumID);
origImage = MediaStore.Images.Media.getBitmap(contentResolver, imageUri_t);
The albumID is collected earlier using a cursor query to get the MediaStore.Audio.AudioColumns.ALBUM_ID column. I also tried with MediaStore.Audio.Albums_ID, but the same result happens.
It's worth noting that it works fine in API 29 and 30 using the newer loadThumnail introduced in API 29
origImage = contentResolver.loadThumbnail(imageUri_t, new android.util.Size(256, 256), null);
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我发现了。错误有点错误,实际上出现了错误,因为它找不到我要求的路径。我
用
这线替换了这条线,我认为任何一个专辑tart在API 29及以下的位置都比API 30保持在不同的位置。不确定,但希望这对将来的人对我同样困惑的人有帮助
I figured it out. The error is a bit of misnomer, the actual error came because it couldn't find the path I was requesting. I replaced this line
With this
I assume either album art is kept in a different place on API 29 and below than API 30. Not sure, but hopefully this helps someone in the future who's equally confused as I was