【发布时间】:2018-01-30 15:30:12
【问题描述】:
这段代码:
imageView = (ImageView) findViewById(R.id.avatar);
Bitmap photo = ((GlideBitmapDrawable)imageView.getDrawable().getCurrent()).getBitmap();
ByteArrayOutputStream bos = new ByteArrayOutputStream();
photo.compress(Bitmap.CompressFormat.PNG,100,bos);
byte[] bArray = bos.toByteArray();
返回此错误:
E/AndroidRuntime: 致命异常: main
java.lang.ClassCastException: android.graphics.drawable.BitmapDrawable 不能转换为 com.bumptech.glide.load.resource.bitmap.GlideBitmapDrawable
【问题讨论】:
-
你试过这篇文章了吗-->stackoverflow.com/questions/37701061/…
-
实际上我使用 Bitmap.createScaledBitmap(bmp,x,y,bool) 将图像加载到 ImageView 中,现在我想使用 Glide (GlideBitmapDrawable) 检索它以存储在数据库中
-
这部分是我想要的,也是相反的
标签: java android android-glide