Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
593 views
in Technique[技术] by (71.8m points)

android - Not Getting Thumb with Genres - Universal Music Player

I am using UMP example provided by Google, I have not made any change in my code, even I have not tried anything out of the box, I just imported your project into my work-space and checked it on my device, and found that I am not getting Thumb with Genres (Songs by genre) and List of Genres...

Whereas I supposed to get Thumb from our JSON, here is what I have tried (but no success) -

holder.mImageView.setImageBitmap(description.getIconBitmap());

UPDATE # 1 AS PER SUGGESTED BY @NageshSusarla here

      holder.mTitleView.setText(description.getTitle());
      holder.mDescriptionView.setText(description.getSubtitle());

        AlbumArtCache cache = AlbumArtCache.getInstance();
        Bitmap art = cache.getIconImage(url);
        if (art == null) {
            cache.fetch(url, new AlbumArtCache.FetchListener() {
                @Override
                public void onFetched(String artUrl, Bitmap bitmap, Bitmap icon) {
                    if (artUrl.equals(url)) {
                        holder.mImageView.setImageBitmap(icon);
                    }
                }
            });
        } else {
            holder.mImageView.setImageBitmap(bitmap);
        }

     holder.mImageView.setImageBitmap(description.getIconBitmap());

and getting Cannot resolve symbol 'url'

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
  1. The icon bitmap may not have been set. It's best to use the AlbumartCache to fetch the icon and then set it on the imageView. The url to be passed to AlbumArtCache.getInstance().fetch(url,..) is description.getIconUri().toString()
  2. The reason you may not be seeing it in uAmp is because of the tint being applied to it. You can remove the tint from media_list_item.xml to try out the changes.

Aside: This is indeed by design and the icon is only shown at the bottom when a user selects the item to be played.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...