Hello.

On the G1....

Say you have a custom view class.

It has an inner-class with some view state. This inner-class 
references some variables in the outer class. The outer-class 
instances the inner-class and holds a reference to it.

Now, say you clone the inner class reference, and pass the copy to a 
new instance of the custom view in another activity (so the new view 
instance can pick up where the previous one left off).

In the new activity, new view instance, inner-class view state clone, 
you find that the "this pointer" is that of the OLD view parent, and 
that attempts to access variables in the outer class access variables 
in the OLD outer class instance.

In the debugger, it appears there is an anonymous "pointer" 
("Outer-class$0") to the enclosing outer-class that was not cloned / 
setup properly by the native clone helper and runtime. It still 
points back to the old outer-class.

Not being an Uber Java Wonk(tm), you rewrite your code to not use 
inner-classes, and all works well. But you decide to write to the 
list and see if this is maybe a Dalvik bug, or just something you 
shouldn't try to do in the first place.

-- Ward


--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to