On 4/10/2010 10:38 AM, NoraBora wrote:
I understand sBackground has a reference to TextView, and the TextView
has a reference to Activity.
I know when a device is rotated, Activity is destroyed and created
again.
but I think when a new Activity is created, sBackground setCallback a
new TextView and the TextView has reference to the new Activity.
Then the old TextView and the old Activity is not refered by
sBackground so they can be garbage-collected.
which means this code has no memory-leaks.
You are basically right, it is not a leak in the "classical" C-style sense.
But...
An Activity is also destroyed when you navigate back in the activity
stack within your own application and the above code (or rather the
static variable) would hold on to the activity needlessly.
Michael
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en