Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
public class NutritionFactFragment extends Fragment implements LoaderManager.LoaderCallbacks<Cursor> {
public static final int FRUIT_LOADER = 1;
public static final int VEGGIE_LOADER = 2;
...
@Override
public Loader<Cursor> onCreateLoader(int id, Bundle args) {
switch (id) {
case FRUIT_LOADER:
CursorLoader fruitCursorLoader = new CursorLoader(
getActivity(),
Uri.parse(NutritionContract.Fruit.CONTENT_URI),
null,
null,
null,
null
);
return fruitCursorLoader;
case VEGGIE_LOADER:
CursorLoader veggieCursorLoader = new CursorLoader(
getActivity(),
Uri.parse(NutritionContract.Veggies.CONTENT_URI),
null,
null,
null,
null
);
return veggieCursorLoader;
default:
return null;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.