Calling getDrawable multiple times in a row, is the drawable cached & optimized?

21 Views Asked by At

Simple question, I think the titled tells it all! I want to know if it's ok to do multiple calls to the same getDrawable, or should I call it once and store in a lazy val and reuse it?

1

There are 1 best solutions below

0
General Tony On

Its is always better to use lazy val, Cause when using lazy val the drawable will initialize once and will be ready to use from cache which was effiecient way. But when you call getDrawable multiple time it might initialize and reload the drawable each time you call. So it has impact on performance.