![](/img/trans.png)
[英]How play a track from a album on Spotify so that the next track of the album will play afterwards using Spotify App Remote SDK for Android?
[英]For the Android Spotify API, how do I get the album artowrk image into an imageView? I've tried using Track but no good
我試過使用 Track 來抓取專輯插圖,但仍然沒有顯示任何內容。 我不確定 Picasso 是否可以提供幫助 - 我試過了,但又一次,沒有運氣。
mSpotifyAppRemote.getPlayerApi().subscribeToPlayerState().setEventCallback(playerState -> {
final Track track = playerState.track;
if (track != null) {
Log.d("MainActivity", track.name + " by " + track.artist.name);
album_artwork.setImageResource(track.imageUri.hashCode());
}
});
如果您正在獲取藝術品圖像 url。請先驗證 url 圖像 url 是否有效。 然后通過使用 Picasso,您需要做的就是:
Picasso.get().load(track.imageUri).into(album_artwork);
請查看 Spotify 官方 android 示例。 https://github.com/spotify/android-sdk/tree/master/app-remote-sample
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.