cover art on android

I am developing a sort of media player for android. The question is how can i get the cover art of audio file on android. For example the default android media player shows album covers when listing albums, how can i get this artworks.

Asked by: Sawyer823 | Posted: 20-01-2022

Answer 1

Uri sArtworkUri = Uri.parse("content://media/external/audio/albumart");
Uri uri = ContentUris.withAppendedId(sArtworkUri, album_id);
ContentResolver res = context.getContentResolver();
InputStream in = res.openInputStream(uri);
Bitmap artwork = BitmapFactory.decodeStream(in);

More complete sample code can be found in Android Music player source here method getArtworkQuick.

Answered by: Blake753 | Posted: 21-02-2022

Answer 2

You can use


class and get track info i.e. Title,Artist,Album,Image

Bitmap GetImage(String filepath)              //filepath is path of music file
 Bitmap image;

MediaMetadataRetriever mData=new MediaMetadataRetriever();
            byte art[]=mData.getEmbeddedPicture();
            image=BitmapFactory.decodeByteArray(art, 0, art.length);
    catch(Exception e)
    return image;

Answered by: Melanie344 | Posted: 21-02-2022

Answer 3

I don't know why everybody is making it so complicated you can use Glide to achieve this in simplest and efficient way with just 1 line of code

Declare this path in App Constants -

final public static Uri sArtworkUri = Uri

Get Image Uri using Album ID

Uri uri = ContentUris.withAppendedId(PlayerConstants.sArtworkUri,

Now simply display album art using uri :-


Glide will handle caching, scaling and lazy loading of images for you.

Hope it help somebody.

Answered by: Charlie644 | Posted: 21-02-2022

Answer 4

Here i can attach one function that is return album art from media store .

Here in function we just have to pass the album_id which we get from Media store .

public Bitmap getAlbumart(Long album_id) 
        Bitmap bm = null;
            final Uri sArtworkUri = Uri

            Uri uri = ContentUris.withAppendedId(sArtworkUri, album_id);

            ParcelFileDescriptor pfd = context.getContentResolver()
                .openFileDescriptor(uri, "r");

            if (pfd != null) 
                FileDescriptor fd = pfd.getFileDescriptor();
                bm = BitmapFactory.decodeFileDescriptor(fd);
    } catch (Exception e) {
    return bm;

Answered by: David507 | Posted: 21-02-2022

Answer 5

Based on your comments to others, it seems like your question is less about Android and more about how to get album art in general. Perhaps this article on retrieving album art from Amazon will be helpful. Once you have a local copy and store it as Nick has suggested, I believe you should be able to retrieve it the way Fudgey suggested.

Answered by: Melissa784 | Posted: 21-02-2022

Answer 6

Android only recognizes files named "AlbumArt.jpg" as Album Covers. Just put the pictures with that name in the album folder and you'll be fine..

Answered by: Joyce901 | Posted: 21-02-2022

Answer 7

I don't know if you read that google is making Stackoverflow the official Android app development Q&A medium but for beginner questions... Now, I know nothing about developing in andriod, but a quick search of the Android Developers site, I found this:


Hopefully it'll help.

Answered by: Cherry166 | Posted: 21-02-2022

Similar questions

android - digital compass problem

I am creating an augmented reality application and I noticed that the stored locations don't appear appear on the correct direction if I try to use the camera view (using layar or wikitude API). The problem is that the digital compass doesn't show north correctly when you try to look at the known objects through the camera view. If align the phone with the ground (look at my shoes) the locations appear at the screen accord...

android - How to remove labels from a MapView?

I am trying to make a satellite view (via a MapView) without labels. How can I do this?

android - Custom title with image

i'm creating custom title for activity by disabling standard one and managing everything myself. I wonder if it's possible to replace/theme standart title to my needs. I can customize size, background image, and text via themes by changing windowXYZStyle items. The only thing i couldn't find - how i can add image instead of text. I've tried requestWindowFeature(Window.FEATURE_CUSTOM_TITLE) and ...

canvas - Android draw with blur

I need do draw on Android's Canvas using Blur effect, it is a very simple feature, I need to draw a circular area, which is blurred (the foreground) and the background transparent, I can do everything with manipulating the colour alpha to do it with custom transparency but I need it to be blurred instead of transparent.. any ideas?

layout - How to resize a android webview after adding data in it

In a layout (linear, vertical) hierarchy I've got several views and one of them is a WebView. They all have same parameters: android:layout_width="fill_parent" android:layout_height="wrap_content" For all views, the spacing between elements is correctly handled but for the Webview there is a lot of spaces after the displayed text inside. I set the (HTML) text of the webview in the ...

How to find easily the source of an android class

I know I can access android source code from, but it's hard to select the right git repo if I only know the package and the name of an android class. Isn't there a way to locate a file in

camera - Android Intent Save Path

At the moment I am using two intents. One for voice-recording, another for the camera: Intent photoIntent = new Intent(""); startActivityForResult(photoIntent, ACTIVITY_TAKE_PHOTO); Intent voiceIntent = new Intent(MediaStore.Audio.Media.RECORD_SOUND_ACTION); startActivityForResult(voiceIntent, ACTIVITY_RECORD_SOUND); My aim is to put an Extra to each of t...

Android "hover" event in custom layout

I have a custom layout that I have written that basically just displays a bunch of ImageViews. I am handing onTouch events for all the ImageViews in my layout. However, if a user touches one imageView and then drags over another ImageView, I would like to be able to handle that as well. How would I go about capturing this behaviour?

android - What is the ideal place to cache images?

I am fetching a lot of thumbnails in my application from a remote server and lazy-loading these in a list view. The image fetches run in a background AsynTask and when completed the fetched images are stored in a HashMap using SoftReferences. This works just fine but when the images in the cache gets GC’d, the fetches have to be rerun. I could have stored them on the SD card so there would be no...

How to create a tree view in Android?

There are no controls in Android that provide Tree-like View. There is an ExpandableList View which I suspect could be used to creating one. Have you tried imlpementing such a control? How would one implement such a control in Android?

Still can't find your answer? Check out these communities...

Android Google Support | Android Community | Android Community (Facebook) | Android