As the title stated, in my current apps, I have a case to load images from local resources to RecyclerView
. Please note that not loading images from url, so no network required.
I do know that, if loading images from url, those image loading libraries will improve our app's performance because of their amazing optimized loading and caching features.
But, does that apply too when we load images from local resources?
I did found this resource, it did state that if we load only an image from local resources without any modification then we don't need this library.
So, how about if we load it in RecyclerView
where we need to load lots of images from local resources? Does it improve our app's performance? Or ImageView.setImageResource()
is enough?
Note that, there is a possibility the same image being reused.
If your images are stored in the drawable
directories and you already have different sizes for different resolutions, then using another library for loading those images would not add much benefit.
However, if you have your images in raw
or you don't have different sizes, just big ones, using something like Glide turns out to be quite useful, since it will resize down the image to fit the required space and stores the smaller image in the cache (memory or disk, depending on how you configure it). This considerably speeds up subsequent loads since the android UI doesn't need to do the scaling again.