android mediastore art
I have searched for problems like mine ,they are there but do not answer my question. Here is my problem: I am developing a small Android MediaPlayer app that will play/pause , stop , nextSong,prevSong AND display the album art , but I dont know how to display the art. I can read it on cursor but I dont know how开发者_如何学编程 to implement it to a point where I can see it displayed on the screen. I am brand-new in Android, so a piece of code would be too appreciated ...
Thank you
Cursor cur = getContentResolver().query(Albums.EXTERNAL_CONTENT_URI, new String[]
{Albums.ALBUM_ART}, Albums._ID + "=?", new String[] {albumid}, null);
cur.moveToFirst();
String art = cur.getString(cur.getColumnIndex(Albums.ALBUM_ART));
ImageView ivalbumart = (ImageView)findViewById(R.id.albumart);
ivalbumart.setImageURI(Uri.fromFile(new File(art)));
Apologies for typos... that was culled from some code I had, originally split into two different methods. Not all albums have art, so you have to check for that... not something I show in the code above.
精彩评论