On Mon, Oct 3, 2011 at 11:00 PM, luciofm <[email protected]> wrote:
> The framework would take care of reattaching my Fragment to the new
> Activity, and from the Lifecyle of Fragments it will call onCreateView,
> which will return a new View hierarchy, and here lies the problem, because
> on my adapter (wich is retained with the fragment) I was using a setTag to
> save the viewholder, but this view is no longer available (onDestroyView)
> but it still has a reference to it, by my Adapter which still has a
> reference to my activity, leaking the context.

There is no setTag() on a ListAdapter.

> So, here is my question again, there is some way to use the ViewHolder
> pattern on this case?

It should work fine. Row widgets hold references to their ViewHolder
via setTag(). Those row widgets are discarded on a configuration
change, which in turn discards their ViewHolders. The list is newly
populated by the ListAdapter, creating all new ViewHolder instances
for the all-new row widgets.

-- 
Mark Murphy (a Commons Guy)
http://commonsware.com | http://github.com/commonsguy
http://commonsware.com/blog | http://twitter.com/commonsguy

Android App Developer Books: http://commonsware.com/books

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