call the recycle method in onDestroy() if you finish using it when the activity / fragment is destroyed. Otherwise recycle it as soon as you are finished using it
Recycle the bitmap in Fragment/Activity in Android
-
21-07-2023 - |
Question
Hello I am trying to get bitmap
from URL in the Fragment
. I know programmer should recycle the bitmap
to release the memory and avoid OutOfMemoryException
.
So here I am very confused where I should call recycle
method in Fragment
and Activity
, I see many answer but that didn't seems to me any nice answer like android fragment: recycle bitmap
Can you please help me to clear my confusion.
Thanks in advance
La solution
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow