Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Message from discussion Scenario where initLoader() does not call onLoadFinished()
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Jeremy Drake  
View profile  
 More options Oct 10 2011, 1:47 pm
From: Jeremy Drake <jeremydr...@eacceleration.com>
Date: Mon, 10 Oct 2011 10:47:04 -0700 (PDT)
Local: Mon, Oct 10 2011 1:47 pm
Subject: Re: Scenario where initLoader() does not call onLoadFinished()
This sounds suspiciously like the issue I am having
http://groups.google.com/group/android-developers/browse_thread/threa...

I was able to reproduce the bug with pushing a new activity in my own
app, which uses an AsyncTaskLoader instead of a CursorLoader.

Hopefully somebody familiar with the Fragment/FragmentManager/Loader/
LoaderManager code will reply to one (or both) of these threads with
some additional insight.  I'm planning to enter a bug/issue in the
next day or two if I do not hear anything to the contrary.

You may want to try setting a breakpoint around the time you call
initLoader, and see if the LoaderManager's mDestroyed member is true.
This is what led me to believe that the issue is with the lifetime
management of the loader manager.

On Oct 7, 6:29 am, kaciula <catalin.moro...@gmail.com> wrote:

> 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 must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.