SqliteDatabase我的应用程序中有一个.在此数据库中,我保存了Sting和Blob(用于保存图像).该图像以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) SqliteDatabase我的申请中有一个。在此数据库中,我保存了Sting和Blob(用于保存图像)。该图像使用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)