8

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'

Community
  • 1
  • 1
Sophie
  • 2,594
  • 10
  • 41
  • 75

2 Answers2

1
  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.

Nagesh Susarla
  • 1,660
  • 10
  • 10
0

This is by design. To keep the navigation cleaner, we decided to not show the MediaItem icon on the local browsing UI. Other browsing UI's may show it, like Android Auto and Android Wear.

I think you should check it in issues of android-UniversalMusicPlayer. Take a look at comment given by mangini here.

If you want to change uAmp to show the MediaDescription.getIconUri, set the holder.mImageView at this.

Ravi
  • 34,851
  • 21
  • 122
  • 183
  • so finally I have to use this: holder.mImageView.setImageBitmap(description.getIconBitmap()); or something else ? – Sophie Jan 08 '16 at 05:47