belongs to Maven artifact com.android.support:loader:28.0.0-alpha1
LoaderManager.LoaderCallbacks
public
static
interface
LoaderManager.LoaderCallbacks
android.support.v4.app.LoaderManager.LoaderCallbacks<D> |
Callback interface for a client to interact with the manager.
Summary
Public methods | |
---|---|
abstract
Loader<D>
|
onCreateLoader(int id, Bundle args)
Instantiate and return a new Loader for the given ID. |
abstract
void
|
onLoadFinished(Loader<D> loader, D data)
Called when a previously created loader has finished its load. |
abstract
void
|
onLoaderReset(Loader<D> loader)
Called when a previously created loader is being reset, and thus making its data unavailable. |
Public methods
onCreateLoader
Loader<D> onCreateLoader (int id, Bundle args)
Instantiate and return a new Loader for the given ID.
This will always be called from the process's main thread.
Parameters | |
---|---|
id |
int : The ID whose loader is to be created. |
args |
Bundle : Any arguments supplied by the caller. |
Returns | |
---|---|
Loader<D> |
Return a new Loader instance that is ready to start loading. |
onLoadFinished
void onLoadFinished (Loader<D> loader, D data)
Called when a previously created loader has finished its load. Note
that normally an application is not allowed to commit fragment
transactions while in this call, since it can happen after an
activity's state is saved. See 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 aCursorAdapter
, use theCursorAdapter(android.content.Context, android.database.Cursor, int)
constructor without passing in eitherFLAG_AUTO_REQUERY
orFLAG_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. - The Loader will release the data once it knows the application
is no longer using it. For example, if the data is
a
Cursor
from aCursorLoader
, you should not call close() on it yourself. If the Cursor is being placed in aCursorAdapter
, you should use theswapCursor(android.database.Cursor)
method so that the old Cursor is not closed.
This will always be called from the process's main thread.
Parameters | |
---|---|
loader |
Loader : The Loader that has finished. |
data |
D : The data generated by the Loader.
|
onLoaderReset
void onLoaderReset (Loader<D> loader)
Called when a previously created loader is being reset, and thus making its data unavailable. The application should at this point remove any references it has to the Loader's data.
This will always be called from the process's main thread.
Parameters | |
---|---|
loader |
Loader : The Loader that is being reset.
|
Annotations
Interfaces
- ActionBarDrawerToggle.Delegate
- ActionBarDrawerToggle.DelegateProvider
- ActivityCompat.OnRequestPermissionsResultCallback
- ActivityCompat.PermissionCompatDelegate
- FragmentManager.BackStackEntry
- FragmentManager.OnBackStackChangedListener
- LoaderManager.LoaderCallbacks
- NotificationCompat.Action.Extender
- NotificationCompat.Extender
- SharedElementCallback.OnSharedElementsReadyListener
- TaskStackBuilder.SupportParentable
Classes
- ActionBarDrawerToggle
- ActivityCompat
- ActivityManagerCompat
- ActivityOptionsCompat
- AlarmManagerCompat
- AppLaunchChecker
- AppOpsManagerCompat
- BundleCompat
- DialogFragment
- Fragment
- Fragment.SavedState
- FragmentActivity
- FragmentContainer
- FragmentController
- FragmentHostCallback
- FragmentManager
- FragmentManager.FragmentLifecycleCallbacks
- FragmentManagerNonConfig
- FragmentPagerAdapter
- FragmentStatePagerAdapter
- FragmentTabHost
- FragmentTransaction
- FrameMetricsAggregator
- JobIntentService
- ListFragment
- LoaderManager
- NavUtils
- NotificationCompat
- NotificationCompat.Action
- NotificationCompat.Action.Builder
- NotificationCompat.Action.WearableExtender
- NotificationCompat.BigPictureStyle
- NotificationCompat.BigTextStyle
- NotificationCompat.Builder
- NotificationCompat.CarExtender
- NotificationCompat.CarExtender.UnreadConversation
- NotificationCompat.CarExtender.UnreadConversation.Builder
- NotificationCompat.DecoratedCustomViewStyle
- NotificationCompat.InboxStyle
- NotificationCompat.MessagingStyle
- NotificationCompat.MessagingStyle.Message
- NotificationCompat.Style
- NotificationCompat.WearableExtender
- NotificationCompatExtras
- NotificationCompatSideChannelService
- NotificationManagerCompat
- RemoteInput
- RemoteInput.Builder
- ServiceCompat
- ShareCompat
- ShareCompat.IntentBuilder
- ShareCompat.IntentReader
- SharedElementCallback
- TaskStackBuilder
Exceptions