Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chelseatroy/dacdd9ba3336d9c4415d3c5a5b78cc19 to your computer and use it in GitHub Desktop.
Save chelseatroy/dacdd9ba3336d9c4415d3c5a5b78cc19 to your computer and use it in GitHub Desktop.
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