I have a ViewPager that loads a lot of fragments (+20). Each of these fragments is just an instance of one single fragment, and the only thing that changes is the content of each of them. The user interface for this fragment has, among other widgets, 4 different ImageViews that load the same resource, but, of course, are located in different parts of the user interface.
Now, considering that I can have, for example, 20 fragments with this scheme, we are talking about 80 (20 * 4) ImageViews that will load the same.
So this made me wonder if the Android cache really somehow loads resources from xml layouts? If not, is there a better option by simply loading this code into the code, caching it and linking it to the corresponding ImageView programmatically each time a new instance of this fragment is created?
Thanks.
source share