[英]Downloading image from firebase storage using picasso: out of memory exception
I am working on an android app which needs to download images from firebase backend but after downloading and showing 5 to 6 images in my recyler view, out of memory exception is thrown. 我正在开发一个Android应用程序,它需要从firebase后端下载图像,但在我的recyler视图中下载并显示5到6个图像后,会抛出内存不足异常。
I have used an image compressing library due to which the size of each image is nearly 300 to 400 KB. 我使用了图像压缩库,因为每个图像的大小接近300到400 KB。
I have added
<application android:largeHeap="true"
but still there is same issue 我添加了<application android:largeHeap="true"
但仍存在同样的问题
My code : 我的代码:
//Retriving image from picasso
Picasso.Builder builder = new Picasso.Builder(c);
builder.listener(new Picasso.Listener() {
@Override
public void onImageLoadFailed(Picasso picasso, Uri uri, Exception exception) {
Toast.makeText(c,exception.getMessage(),Toast.LENGTH_LONG).show();
}
});
Picasso pic = builder.build();
pic.load(currentPost.getDownloadlinkDB()).into(((MyViewHolder_Image) holder).imageView, new Callback() {
@Override
public void onSuccess() {
}
@Override
public void onError() {
Toast.makeText(c, "Problem in downloading image from server", Toast.LENGTH_SHORT).show();
}
});
Snapshot of the exception 异常快照
How to solve this problem? 如何解决这个问题呢?
Add this to your Manifest file. 将其添加到您的清单文件中。 Inside application tag 内部应用标签
<application
android:largeHeap="true"
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.