|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public static interface LoaderManager.LoaderCallbacks<D>
Callback interface for a client to interact with the manager.
Method Summary | |
---|---|
Loader<D> |
onCreateLoader(int id,
android.os.Bundle args)
Instantiate and return a new Loader for the given ID. |
void |
onLoaderReset(Loader<D> loader)
Called when a previously created loader is being reset, and thus making its data unavailable. |
void |
onLoadFinished(Loader<D> loader,
D data)
Called when a previously created loader has finished its load. |
Method Detail |
---|
Loader<D> onCreateLoader(int id, android.os.Bundle args)
id
- The ID whose loader is to be created.args
- Any arguments supplied by the caller.
void onLoadFinished(Loader<D> loader, D data)
FragmentManager.openTransaction()
for further discussion on this.
This function is guaranteed to be called prior to the release of the last data that was supplied for this Loader. At this point you should remove all use of the old data (since it will be released soon), but should not do your own release of the data since its Loader owns it and will take care of that. The Loader will take care of management of its data so you don't have to. In particular:
The Loader will monitor for changes to the data, and report
them to you through new calls here. You should not monitor the
data yourself. For example, if the data is a Cursor
and you place it in a CursorAdapter
, use
the CursorAdapter.CursorAdapter(android.content.Context,
android.database.Cursor, int)
constructor without passing
in either CursorAdapter.FLAG_AUTO_REQUERY
or CursorAdapter.FLAG_REGISTER_CONTENT_OBSERVER
(that is, use 0 for the flags argument). This prevents the CursorAdapter
from doing its own observing of the Cursor, which is not needed since
when a change happens you will get a new Cursor throw another call
here.
Cursor
from a CursorLoader
,
you should not call close() on it yourself. If the Cursor is being placed in a
CursorAdapter
, you should use the
CursorAdapter.swapCursor(android.database.Cursor)
method so that the old Cursor is not closed.
loader
- The Loader that has finished.data
- The data generated by the Loader.void onLoaderReset(Loader<D> loader)
loader
- The Loader that is being reset.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |