I have a simple activity with one fragment. The fragment uses a CursorLoader 
to load some data from a ContentProvider. I just call initLoader() inside 
onActivityCreated() and I populate the UI in onLoadFinished(). If I switch 
orientations, everything works as expected (onLoadFinished() is called 
again).

Now, if I move to a new activity, press BACK to get back to my first 
activity and then switch orientations, I see that onLoaderReset() is called 
and then, in onActivityCreated(), although initLoader() is called, 
onLoadFinished() is never called after that. And as a consequence, my UI 
shows no data.

After doing some testing, I see that this problem appears only if I use 
setRetainInstance(true) in my fragment. So what's the deal? And how can I 
fix this without removing setRetainInstance(true)? Do I have to do something 
in onLoaderReset()? Do I have to somehow give the loader the new activity as 
the context?

Thanks.

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to