Android Question Releasing Memory when Activity finishes

Gary Milne

Active Member
Licensed User
Longtime User
I'm capturing the user press of the Back key and doing an Activity.Finish. My understanding is that this should release all of the resources, ie screens, layouts, views and anything defined as global that are associated with that Activity. Is this a correct assumption or should I explicitly do an Activity.RemoveAllViews first, and then call Activity.Finish?

Is there anything else I should explicitly be doing to free up resources?

If a "memory leak" existed within an Activity would these steps release that memory?

Thanks for any answers.
 

Gary Milne

Active Member
Licensed User
Longtime User
Can you give an example of how can one Activity can have a live reference to a view in another activity? I don't see how that situation arises.
 
Upvote 0

Gary Milne

Active Member
Licensed User
Longtime User
Yes, of course. That makes perfect sense. Thanks for the clarification.
 
Upvote 0
Top