Skip to content

Instantly share code, notes, and snippets.

@vsvankhede
Created August 7, 2016 11:07
Show Gist options
  • Save vsvankhede/2b12592ce3b6a3f2853fffd578c24768 to your computer and use it in GitHub Desktop.
Save vsvankhede/2b12592ce3b6a3f2853fffd578c24768 to your computer and use it in GitHub Desktop.
Demo Activity implements loader callback.
public class DemoActivity extends Activity implements LoaderManager.LoaderCallbacks<T> {
private static final int LOADER_ID = 1;
public void onCreate(Bundle savedInstanceState) {
getLoaderManager().initLoader()
}
public Loader<T> onCreateLoader(Loader<T> loader, T data) {
// Create the loader
}
public void onLoadFinished(Loader<T> loader,T data) {
// User the delivered data.
}
public void onLoaderReset(Loader<T> loader) {
// The loader data is invalid, stop using it.
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment