Reputation: 155
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.
I have used an image compressing library due to which the size of each image is nearly 300 to 400 KB.
I have added
<application android:largeHeap="true"
but still there is same issue
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();
}
});
How to solve this problem?
Upvotes: 4
Views: 471
Reputation: 742
Add this to your Manifest file. Inside application tag
<application
android:largeHeap="true"
Upvotes: 2