java cropper_android - 多次使用Glide将图像作为位图加载到imageview中 - 堆栈内存溢出...

我想创建一个像Instagram这样的应用程序。 我的用户可以从存储中选择自己的图像,进行裁剪并将其发送到服务器。 我有一个片段,顶部是CropperImageView ,底部是RecyclerView 。 我使用该库进行图像裁剪。 当用户单击RecyclerView的图像时,我将该图像作为位图加载并为CropperImageView设置该位图,如下所示

Glide.with(getContext()).asBitmap().load(imageFilePath).into(new SimpleTarget() {

@Override

public void onResourceReady(@NonNull Bitmap resource, @Nullable Transition super Bitmap> transition) {

cropperView.setImageBitmap(resource);

}

});

因为用户可以多次单击Recyclerview图像项目。 我从Glide获得OutOfMemory异常。 以下是logcat中的Glide日志。

W/Glide: Load failed for /storage/4BC8-1B11/DCIM/Camera/20180520_210400.jpg with size [-2147483648x-2147483648]

class com.bumptech.glide.load.engine.GlideException: Failed to load resource

There was 1 cause:

java.lang.OutOfMemoryError(Failed to allocate a 51121164 byte allocation with 16701336 free bytes and

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值