So I have several ImageViews in a single Activity and all of them use the same image bitmap from a resource.
ImageViewOne.setImageResource(R.drawable.frequently_used_image);
ImageViewTwo.setImageResource(R.drawable.frequently_used_image);
ImageViewThree.setImageResource(R.drawable.frequently_used_image);
Does android allocate memory to load the bitmap once and reuse it for all other ImageViews using the same resource? Or does it load the bitmap each time it is set to an ImageView?
Thanks!
Quoting Dianne Hackborn from Android team:
Also keep in mind that Resources already maintains a cache of Drawables for you, using this facility, so there is no need for you to implement your own cache for any Drawables you are retrieving from Resources.
from this answer: Consequences of drawable.setCallback(null);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With