Actually it should be:

Loader loader = getLoaderManager().getLoader(-1);
    if (loader != null && !loader.isReset()) {
      getLoaderManager().restartLoader(-1, null, this);
    } else {
      getLoaderManager().initLoader(-1, null, this);
    }


You should only restart the loader if the loader is NOT reset.  So the 
second condition in the if condition changes to the negated version.  I got 
this to work for me.


On Thursday, January 12, 2012 10:47:58 PM UTC-8, David Wu wrote:
>
> Hi there, 
>
> I ran into a very similar problem and solved it by replacing the 
> following line in onActivityCreate() 
>
>     getLoaderManager().initLoader(0, getArguments(), this); 
>
> to 
>
>     Loader loader = getLoaderManager().getLoader(0); 
>     if ( loader != null && loader.isReset() ) { 
>         getLoaderManager().restartLoader(0, getArguments(), this); 
>     } else { 
>         getLoaderManager().initLoader(0, getArguments(), this); 
>     } 
>
>
> Not sure if it addresses your problem.  I hope it helps. 
>
>
> On Dec 13 2011, 3:29 pm, kaciula <[email protected]> wrote: 
> > As I said, the initial bugs were fixed by revision 4 of ACL. However, 
> there 
> > is still a bug present in both the ACL and Android. I've tested it with 
> > Android version 3.2 and 4.0. Check out the updated project athttps://
> github.com/kaciula/BugRetain 
> > 
> > I think this is a pretty important bug. The scenario is this: From 
> activity 
> > A, go to activity B, switch once the orientation and go back to activity 
> A. 
> > As a consequence of this bug, I can't write an app with fragments that 
> use 
> > setRetainInstance and is available in both orientations. I really need a 
> > workaround until the Android guys fix the issue. Thoughts?

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