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

有帮助吗?

解决方案

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

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top