I am working on an Android application that should load images from the firebase backend, but after loading and displaying from 5 to 6 images, a memory exception is thrown in my recyler view.
I used the image compression library, due to which the size of each image is from 300 to 400 KB.
I added <application
android:largeHeap="true", but still have the same problem
My code is:
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();
}
});
Exception snapshot

How to solve this problem?
source
share