Picasso Gives Out Of Memory When Load An Image
Solution 1:
To load small images like icons o launchers we can use .setImageResource(image) However, to load big images is better to use Picasso and get the benefit of simplicity and local caching.
It is necesary to setup Picasso properly according to the documentation:
"Be sure to use fit() to resize the image before loading into the ImageView. Otherwise, you will consume extra memory, experience sluggish scrolling, or encounter out of memory issues if you render a lot of pictures".
if (imageUri != null && !imageUri.isEmpty()) {
Picasso.with(context).load(imageUri)
.fit().centerCrop()
.placeholder(R.drawable.user_placeholder)
.error(R.drawable.user_placeholder_error)
.into(imageView);
}
Solution 2:
Convert Your image to bitmap and load image efficiently
http://developer.android.com/training/displaying-bitmaps/load-bitmap.html and check this url too Strange out of memory issue while loading an image to a Bitmap object
if you are using any delay while loading images(eg: timer) please check it
i hope it will helps you...
Post a Comment for "Picasso Gives Out Of Memory When Load An Image"