use of androidx.loader.app.LoaderManager in project SeriesGuide by UweTrottmann.
the class ShowsNowFragment method initAndMaybeRestartLoader.
/**
* Init the loader. If the loader already exists, will restart it (the default behavior of init
* would be to get the last loaded data).
*/
private <D> void initAndMaybeRestartLoader(int loaderId, LoaderManager.LoaderCallbacks<D> callbacks) {
LoaderManager loaderManager = LoaderManager.getInstance(this);
boolean isLoaderExists = loaderManager.getLoader(loaderId) != null;
loaderManager.initLoader(loaderId, null, callbacks);
if (isLoaderExists) {
loaderManager.restartLoader(loaderId, null, callbacks);
}
}
Aggregations