小编ere*_*ere的帖子

如何在Android上的Glide中设置位图图像

SqliteDatabase我的应用程序中有一个.在此数据库中,我保存了StingBlob(用于保存图像).该图像以byte []保存在应用程序中.我借助以下代码将此图像转换为Bitmap:

    byte[] Recycler_imageByte;
    Bitmap Recycler_theImage;

holder.Recycler_imageByte = data.get(position).getKey_image();
ByteArrayInputStream imageStream = new ByteArrayInputStream(holder.Recycler_imageByte);
holder.Recycler_theImage = BitmapFactory.decodeStream(imageStream);
Run Code Online (Sandbox Code Playgroud)

我想在Glidelibary中显示这个图像,我编写了以下代码:

Glide.with(context).load(holder.Recycler_theImage).asBitmap().into(holder.Recycler_adapter_image);
Run Code Online (Sandbox Code Playgroud)

但是,当我运行应用程序时,会显示以下错误:

03-15 10:23:14.311 22440-22440/com.tellfa.dastanak E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.tellfa.dastanak, PID: 22440
java.lang.IllegalArgumentException: Unknown type class android.graphics.Bitmap. You must provide a Model of a type for which there is a registered ModelLoader, if you are using a custom model, you must first call Glide#register with a ModelLoaderFactory for your custom model class …
Run Code Online (Sandbox Code Playgroud)

android android-bitmap android-glide

5
推荐指数
2
解决办法
9358
查看次数

如何在Android的Glide中显示数据库图像?

SqliteDatabase我的申请中有一个。在此数据库中,我保存了StingBlob(用于保存图像)。该图像使用byte []保存在应用程序中。我借助以下代码将该图像转换为Bitmap:

    byte[] Recycler_imageByte;
    Bitmap Recycler_theImage;

holder.Recycler_imageByte = data.get(position).getKey_image();
ByteArrayInputStream imageStream = new ByteArrayInputStream(holder.Recycler_imageByte);
holder.Recycler_theImage = BitmapFactory.decodeStream(imageStream);
Run Code Online (Sandbox Code Playgroud)

我想在Glidelibary中显示此图像,我编写了以下代码:

Glide.with(context).load(holder.Recycler_theImage).asBitmap().into(holder.Recycler_adapter_image);
Run Code Online (Sandbox Code Playgroud)

但是,当我运行应用程序时,显示以下错误:

03-15 10:23:14.311 22440-22440/com.tellfa.dastanak E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.tellfa.dastanak, PID: 22440
java.lang.IllegalArgumentException: Unknown type class android.graphics.Bitmap. You must provide a Model of a type for which there is a registered ModelLoader, if you are using a custom model, you must first call Glide#register with a ModelLoaderFactory for your custom model class …
Run Code Online (Sandbox Code Playgroud)

android bitmap android-bitmap android-glide

2
推荐指数
1
解决办法
2599
查看次数

标签 统计

android ×2

android-bitmap ×2

android-glide ×2

bitmap ×1