The call to getLoaderManager().initLoader(0, args, this); is enough to
have your Loader run at least the first time it is created.
Do *not *call 'startLoading()'.
If you want to refresh your Loader's data call
getLoaderManager().*restart*Loader(0,
args, this);
When initLoader or restartLoader is called, the system will call
onLoadFinished with the data at a later time.
On Wednesday, April 3, 2013 7:28:18 AM UTC-4, Ralph Bergmann wrote:
>
> Hello,
>
>
> I wont to reuse my AsyncTaskLoader. To do it I call:
>
> Loader<Result> loader = getLoaderManager().initLoader(0, args, this);
> loader.startLoading();
>
> In this startLoading method is a if-statment:
>
> if (info.mHaveData && mStarted) {
> // If the loader has already generated its data, report it now.
> info.callOnLoadFinished(info.mLoader, info.mData);
> }
> (
> http://grepcode.com/file/repository.grepcode.com/java/ext/com.google.android/android/4.2.2_r1/android/app/LoaderManager.java#616)
>
>
>
>
> The mStarted flag indicate that the LoaderManager of the activity is
> started.
>
> And the info.mHaveData flag indicate that the loader has data or not
> from a previous run.
>
> My problem / question: How can I reset the loader after a previous run
> that it lose its data and info.mHaveData is false? Because I get the
> onLoadFinished call twice and the first one is wrong :-(
>
>
> Ralph
>
--
--
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
---
You received this message because you are subscribed to the Google Groups
"Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.