I have an activity which loads pictures in ImageViews with glide. Here is a sample of my glide code:
Glide.with(ImageVOne.getContext())
.load(geo
You can take several measures to prevent getting Out of Memory Error. They are as follows.
Using GridView/RecycleView to show images. Because they load only what they show. Suppose you have 50 images and 10 images are visible to your screen, it will load only 10. This will ease the pressure from your memory.
Use PLACEHOLDER to load image instead of black-space. You can use low resolution image in drawable as placeholder.
Use THUMBNAILS instead of actual images.
You may use fixed dp for height and width of imageView.
Set skipMemoryCache to true.
CLEAR GLIDE memory onDestroy();
@Override public void onDestroy() {
super.onDestroy();
Glide.get(this).clearMemory();
}
Override to smaller-size :
.override(500, 600) //as example
Here is a refined code for using GLIDE:
Glide.with(this)
.load(url)
.thumbnail(0.5f)
.skipMemoryCache(true)
.diskCacheStrategy(DiskCacheStrategy.ALL)
.placeholder(R.drawable.your_placeHolder)
.into(imageVOne);
You may look at catching mechanism of Glide here.