1
代碼加載專輯封面負載專輯封面到滑翔使用列表視圖
if(cursor != null && cursor.moveToFirst()){ int titleColumn = cursor.getColumnIndex(MediaStore.Audio.Media.TITLE); int idColumn = cursor.getColumnIndex(MediaStore.Audio.Media._ID); int artistColumn = cursor.getColumnIndex(MediaStore.Audio.Media.ARTIST); int albumColumn = cursor.getColumnIndex(MediaStore.Audio.Media.ALBUM); long albumID = cursor.getColumnIndex(MediaStore.Audio.Albums.ALBUM_ID); do { long thisID = cursor.getLong(idColumn); String thisTitle = cursor.getString(titleColumn); String thisArtist = cursor.getString(artistColumn); String thisAlbum = cursor.getString(albumColumn); Glide.with(this) .load(albumID) .asBitmap() .into() //How do I return a value? medialist.add(new SongInfo(thisID, thisTitle, thisArtist, thisAlbum, //Bitmap variable)); } while (cursor.moveToNext());
我想要的專輯封面裝入使用滑翔列表視圖。但是,我在遇到麻煩;
medialist.add(新SongInfo(..);
喜@Divyesh 我無法在我的適配器類初始化Glide.with(本),它說unresolve方法,我該怎麼放在Glide.with後(.. )。 –