Java tutorial
//package com.java2s; /* Sunami - An Android music player which knows what you want to listen to. Copyright (C) 2015 Wojtek Swiderski Sunami is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. Sunami is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. The GNU General Public License can be found at the root of this repository. To contact me, email me at wojtek.technology@gmail.com */ import android.content.Context; import android.database.Cursor; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.provider.MediaStore; public class Main { public static Bitmap decodeBitmapFromAlbumId(Context context, long album_id) { String pathName = getRealPathFromURI(context, album_id); return BitmapFactory.decodeFile(pathName); } public static String getRealPathFromURI(Context context, long album_id) { Cursor cursor = null; try { cursor = context.getContentResolver().query(MediaStore.Audio.Albums.EXTERNAL_CONTENT_URI, new String[] { MediaStore.Audio.Albums.ALBUM_ART }, MediaStore.Audio.Albums._ID + "=?", new String[] { String.valueOf(album_id) }, null); int column_index = cursor.getColumnIndexOrThrow(MediaStore.Audio.Albums.ALBUM_ART); cursor.moveToFirst(); return cursor.getString(column_index); } finally { if (cursor != null) { cursor.close(); } } } }