well you know the objects referred to by WeakReferences can disappear 
at any time, that's the whole point of a WeakReference -- it's a 
"cache" of sorts, the elements of which can be expired as and when 
the VM needs the memory.

if you particularly wanted to use the Map method, as opposed to any 
of the other methods on that page, you could have a Map of regular 
references, and clear the Map out when the receiving Activity has 
retrieved what it needs from it.

hth
J




>I'm working on an application that requires non-serializable objects
>to be passed between Activities.  The following page suggests using a
>HashMap of WeakReferences to accomplish this:
>
>http://developer.android.com/guide/appendix/faq/framework.html
>
>Is this solution safe?  I know Activities are completely destroyed and
>recreated when the screen orientation changes.  Couldn't those weakly
>referenced objects get GCed in the split second when the screen is
>rotated, since they wouldn't be referenced elsewhere at that point?
>
>Thanks,
>Mark
>
>--
>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


-- 
jason.vp.engineering.particle

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