Last active
August 2, 2016 13:01
-
-
Save chelseatroy/7955d7ef826af5f5aecb899cdfe39720 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
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 | |
); | |
fruitCursorLoader.registerListener(FRUIT_LOADER, null); | |
return fruitCursorLoader; | |
case VEGGIE_LOADER: | |
CursorLoader veggieCursorLoader = new CursorLoader( | |
getActivity(), | |
Uri.parse(NutritionContract.Veggies.CONTENT_URI), | |
null, | |
null, | |
null, | |
null | |
); | |
veggieCursorLoader.registerListener(VEGGIE_LOADER, null); | |
return veggieCursorLoader; | |
default: | |
return null; | |
} | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment