meeeee
meeeee

Reputation: 2939

android fragment: recycle bitmap

I am using a DialogFragment from the compatibility package. I have a Bitmap which I need to recycle when the dialog closes, but when I call findViewByID() inside onDestroyView() it returns null. I have also tried keeping a reference to the view from onCreateView() but it is also null by the time onDestroyView() is called.

How can I recycle a bitmap in a DialogFragment when the fragment closes?

Upvotes: 1

Views: 901

Answers (1)

Georgy Gobozov
Georgy Gobozov

Reputation: 13731

onDestroyView() allows the fragment to clean up resources associated with its View, try to recycle bitmap in onDismiss or in other method that called before onDestroyView

Upvotes: 1

Related Questions