If I have a view that I will be referencing with decent regularity (to change its visibility, etc...), is it more efficient to store this View as a member variable or to execute findViewById() each time I need a reference to it?
The member variable requires memory usage, while the method my take more time. Is anyone aware of an established best practice for this?
It is much more efficient to store the reference. The memory cost of the reference will be minimal (I don't remember the exact cost but it's in the order of 4 bytes.)
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