I'm fighting with memory leaks now. So i'm curious if there any way to manually destroy view(in activity onDestroy method) ? The whole layout(activity contentView) is a bit complex because of parent-child references, context references, tags, etc.
GC is not able to collect my layout now. And the problem is hiding deeply in view structure... So the only way to find it - is to try destroy leaf views manualy so at some moment GC will collect root view and give me a knowlege of where is problem located.
My layout structure: ViewFlipper(RelativeLayout, ListView(ViewFlipper(RelativeLayout, RelativeLayout)))
You can remove a View from a ViewGroup, but there is no way to manually destroy a view. If you are getting memory leaks, it is usually because you are holding a long-lived reference to your Context outside of your Views.
It is fine for Views to contain information relating to other Views (i.e. the Context of another view) since all views are destroyed -- it is most likely because the Context is held onto by something (and the context has a handle on most things - i.e. all of your Views) that you are unable to free the memory.
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