i'm using icons on recyclerview row items.And i'm changing icon's colors with Color Filter option in android but i'm wondering which one is faster and better?
I already use color filtering on white drawable but it sometimes does not appear in list row till refresh recyclerview so i just think about to use different drawables. thank you for your interest...
It is hard to say, but I would say that changing the drawable is faster, and this is why I think this:
in order to filter a image the system has to read each pixel from RAM, transform each RGB component in order to add the tint (it's not as simple as adding +3 to the intensity of each pixel), and then write each pixel
changing the drawable implies reading from the flash memory and load it into ram
The thing is that flash storage on mobile devices is pretty fast too these days so I consider it's faster to load than tint images.
BUT it depends on how you create the layout. If you load a image the Android system will recalculate the whole layout if other elements change position when you change the drawable. I don't think they wrote code to keep the layout the same if the new drawable has the same size as the last one, and this will involve more calculations than a simple tinting.