List of usage examples for android.support.v4.content CursorLoader CursorLoader
public CursorLoader(Context context, Uri uri, String[] projection, String selection, String[] selectionArgs,
String sortOrder)
From source file:com.dabay6.android.apps.carlog.ui.vehicle.fragments.VehicleEditFragment.java
/** * {@inheritDoc}//from ww w .j a va 2 s .co m */ @Override public Loader<Cursor> onCreateLoader(final int id, final Bundle bundle) { switch (id) { case MAKE_LOADER_ID: { return new CursorLoader(applicationContext, Make.CONTENT_URI, Make.PROJECTION, null, null, null); } case MODEL_LOADER_ID: { return new CursorLoader(applicationContext, Model.CONTENT_URI, Model.PROJECTION, null, null, null); } default: { return super.onCreateLoader(id, bundle); } } }
From source file:com.grokkingandroid.sampleapp.samples.data.contentprovider.lentitems.LentItemListFragment.java
@Override public Loader<Cursor> onCreateLoader(int loaderId, Bundle args) { if (getActivity() != null) { return new CursorLoader(getActivity(), Items.CONTENT_URI, Items.PROJECTION_ALL, null, null, Items.SORT_ORDER_DEFAULT); } else {/*from w w w.ja va 2s . com*/ return null; } }
From source file:cn.wjh1119.bestnews.ui.fragment.DetailFragment.java
@Override public Loader<Cursor> onCreateLoader(int id, Bundle args) { if (null != mUri) { // Now create and return a CursorLoader that will take care of // creating a Cursor for the data being displayed. return new CursorLoader(getActivity(), mUri, DETAIL_COLUMNS, null, null, null); }/*from ww w .j a va 2s . c o m*/ return null; }
From source file:com.arcusapp.soundbox.data.MediaProvider.java
/** * Returns the id ({@linkplain MediaStore.Audio.Media._ID}) of all the Songs of the specified Artist in the MediaStore. * //from w w w . j av a2s . c o m * @param artist the name of the Artist ({@linkplain MediaStore.Audio.Artists.ARTIST}) * @return list with the ids */ public List<String> getSongsFromArtist(String artist) { List<String> ids = new ArrayList<String>(); String[] projection = { MediaStore.Audio.Media._ID }; String selection = MediaStore.Audio.Media.IS_MUSIC + " != 0 AND " + MediaStore.Audio.Artists.ARTIST + " = ?"; String sortOrder = MediaStore.Audio.Media.TITLE; String[] selectionArgs = new String[] { artist }; CursorLoader cl = new CursorLoader(SoundBoxApplication.getContext(), defaultDirectoryUri, projection, selection, selectionArgs, sortOrder); myCursor = cl.loadInBackground(); while (myCursor.moveToNext()) { ids.add(myCursor.getString(0)); } myCursor.close(); return ids; }
From source file:com.bangz.smartmute.RulelistFragment.java
@Override public Loader onCreateLoader(int id, Bundle args) { String selection = new String(); switch (mViewWhich) { case VIEW_ALL: break;//from w w w . j a v a 2 s . c om case VIEW_LOCATION: selection = RulesColumns.RULETYPE + " = " + RulesColumns.RT_LOCATION; break; case VIEW_WIFI: selection = RulesColumns.RULETYPE + " = " + RulesColumns.RT_WIFI; break; case VIEW_TIME: selection = RulesColumns.RULETYPE + " = " + RulesColumns.RT_TIME; break; } return new CursorLoader(getActivity(), RulesColumns.CONTENT_URI, PROJECTION, selection, null, null); }
From source file:com.matthewmitchell.wakeifyplus.MainActivity.java
public Loader<Cursor> onCreateLoader(int id, Bundle args) { // Now create and return a CursorLoader that will take care of // creating a Cursor for the data being displayed. return new CursorLoader(this, AlarmContentProvider.CONTENT_URI, new String[] { "_id", "time", "name", "onOff" }, "", null, null); }
From source file:com.jpventura.popularmovies.app.CreateLoader.java
protected Loader<Cursor> execute(Context context, String[] projection, MovieSelection movie) { final Uri uri = movie.uri(); final String selection = movie.sel(); final String[] arguments = movie.args(); final String order = movie.order(); return new CursorLoader(context, uri, projection, selection, arguments, order); }
From source file:com.google.android.apps.muzei.settings.SettingsChooseSourceFragment.java
@Override public Loader<Cursor> onCreateLoader(final int id, final Bundle args) { return new CursorLoader(getContext(), MuzeiContract.Sources.CONTENT_URI, new String[] { MuzeiContract.Sources.COLUMN_NAME_COMPONENT_NAME }, MuzeiContract.Sources.COLUMN_NAME_IS_SELECTED + "=1", null, null); }
From source file:com.alchemiasoft.book.fragment.BooksFragment.java
@Override public Loader<Cursor> onCreateLoader(int id, Bundle args) { switch (id) { case ID_LOADER_BOOKS: final boolean owned = args.getBoolean(KEY_OWNED); if (owned) { return new CursorLoader(getActivity(), BookDB.Book.CONTENT_URI, null, SELECTION, SELECT_OWNED, null);/*from ww w . ja v a2s. c om*/ } else { return new CursorLoader(getActivity(), BookDB.Book.CONTENT_URI, null, null, null, null); } default: throw new IllegalArgumentException("loader id=" + id + " is not supported!"); } }
From source file:amhamogus.com.daysoff.fragments.MainListFragment.java
@Override public Loader<Cursor> onCreateLoader(int id, Bundle args) { return new CursorLoader(getActivity(), DaysOffContract.DaysOffCalendarsEntry.CONTENT_URI, new String[] { DaysOffContract.DaysOffCalendarsEntry.COLUMN_CAL_KEY, DaysOffContract.DaysOffCalendarsEntry.COLUMN_CAL_SUMMARY }, null, null, null);//from w w w .j av a2 s . c o m }