我要在这里完成的是,当我调用此方法时:public void setAlbumArt(int index) { android.media.MediaMetadataRetriever mmr = new MediaMetadataRetriever(); mmr.setDataSource(this, Uri.parse(fullsongpath.get(index).Path)); byte [] data = mmr.getEmbeddedPicture(); //albumArt is an Imageview object // convert the byte array to a bitmap if (data != null) { Bitmap bitmap = BitmapFactory.decodeByteArray(data, 0, data.length); albumArt.setImageBitmap(bitmap); //associated cover art in bitmap albumArt.setAdjustViewBounds(true); albumArt.setLayoutParams(new LinearLayout.LayoutParams(500, 500)); } else { albumArt.setImageResource(R.mipmap.default_album_art); //any default cover resourse folder albumArt.setAdjustViewBounds(true); albumArt.setLayoutParams(new LinearLayout.LayoutParams(500,500 )); }}我的应用程式当机,引发错误java.lang.IllegalArgumentException这是专辑Art ImageView<ImageView android:id="@+id/albumArt" android:layout_width="120dp" android:layout_height="120dp" android:layout_alignParentTop="true" android:layout_centerHorizontal="true" android:layout_gravity="center_horizontal" android:src="@mipmap/default_album_art" />这fullsongpath是一个包含此对象的ArrayList:public class SongInfo { public String Path; public String song_name; public String album_name; public String artist_name; public SongInfo(String Path,String song_name,String album_name,String artist_name){ this.Path=Path; this.song_name=song_name; this.album_name=album_name; this.artist_name=artist_name; }}路径是mp3文件的URL我真的不知道是什么导致了这个问题,希望您能提供帮助,我们将不胜感激。
添加回答
举报
0/150
提交
取消