Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/204.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 使用Listview将相册艺术加载到Glide中_Android_Listview_Android Glide - Fatal编程技术网

Android 使用Listview将相册艺术加载到Glide中

Android 使用Listview将相册艺术加载到Glide中,android,listview,android-glide,Android,Listview,Android Glide,加载相册艺术的代码 if(cursor != null && cursor.moveToFirst()){ int titleColumn = cursor.getColumnIndex(MediaStore.Audio.Media.TITLE); int idColumn = cursor.getColumnIndex(MediaStore.Audio.Media._ID); int artistColumn = cur

加载相册艺术的代码

    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());
我正在尝试使用Glide将相册艺术加载到listview中。然而,我在工作中遇到了麻烦

添加(新歌曲信息(…)

你做错了: 使用以下命令:

medialist.add(new SongInfo(thisID, thisTitle, thisArtist, thisAlbum,albumID));
现在,在listview适配器类中,获取medialist和glide方法: 定义:

现在在适配器的构造函数中:

public CustomAdapter(List<Medialist> items, Context context) {
        medialist= items;
        this.con = context;
    }

Glide.with(con)
                    .load(medialist.getAlbumID)
                    .asBitmap()
                    .into(imageview)
publiccustomadapter(列表项、上下文){
媒体列表=项目;
this.con=上下文;
}
滑翔
.load(medialist.getAlbumID)
.asBitmap()
.into(图像视图)
您做错了: 使用以下命令:

medialist.add(new SongInfo(thisID, thisTitle, thisArtist, thisAlbum,albumID));
现在,在listview适配器类中,获取medialist和glide方法: 定义:

现在在适配器的构造函数中:

public CustomAdapter(List<Medialist> items, Context context) {
        medialist= items;
        this.con = context;
    }

Glide.with(con)
                    .load(medialist.getAlbumID)
                    .asBitmap()
                    .into(imageview)
publiccustomadapter(列表项、上下文){
媒体列表=项目;
this.con=上下文;
}
滑翔
.load(medialist.getAlbumID)
.asBitmap()
.into(图像视图)

hi@Divyesh我无法初始化Glide。在我的适配器类中,它表示unsolve方法,我在Glide之后放置什么。在(..)中,hi@Divyesh我无法初始化Glide。在适配器类中,它表示unsolve方法,我在Glide之后放置什么。在(..)中。