-
-
Save jacek-marchwicki/5346268 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Add this template in Preferences > Java > Editor > Templates > New | |
// I stored this snippet with newLoader name, but you can use any name you want | |
// To use this loader your class should implements LoaderCallbacks<Cursor> | |
private static final int ${loaderName} = 0; | |
@Override | |
public Loader<Cursor> onCreateLoader(int id, Bundle args) { | |
switch (id) { | |
case ${loaderName}: | |
return null; | |
default: | |
throw new RuntimeException("Unknown loader id:" + loader.getId()); | |
} | |
} | |
@Override | |
public void onLoadFinished(Loader<Cursor> loader, Cursor data) { | |
switch (loader.getId()) { | |
case ${loaderName}: | |
return; | |
default: | |
throw new RuntimeException("Unknown loader id:" + loader.getId()); | |
} | |
} | |
@Override | |
public void onLoaderReset(Loader<Cursor> loader) { | |
switch (loader.getId()) { | |
case ${loaderName}: | |
return; | |
default: | |
throw new RuntimeException("Unknown loader id:" + loader.getId()); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment