Skip to content

Instantly share code, notes, and snippets.

@npike
Last active December 17, 2015 04:19
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 npike/5549446 to your computer and use it in GitHub Desktop.
Save npike/5549446 to your computer and use it in GitHub Desktop.
Typical CursorLoader creation: pulling a list of car models for a given a car make from a database
@Override
public Loader<Cursor> onCreateLoader(int id, Bundle args) {
final String[] projection = { BaseColumns._ID, ModelContract.Models.COLUMN_NAME_MODEL,
ModelContract.Models.COLUMN_NAME_NICE_NAME };
new CursorLoader(getActivity(), ModelContract.Models.CONTENT_URI, projection,
ModelContract.Models.COLUMN_NAME_MAKE_NAME + "= ?", new String[] {"Jeep"},
ModelContract.Models.COLUMN_NAME_MODEL + " ASC");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment