List of usage examples for android.content CursorLoader CursorLoader
public CursorLoader(Context context, Uri uri, String[] projection, String selection, String[] selectionArgs,
String sortOrder)
From source file:com.google.samples.apps.iosched.session.SessionDetailModel.java
@VisibleForTesting public CursorLoader getCursorLoaderInstance(Context context, Uri uri, String[] projection, String selection, String[] selectionArgs, String sortOrder) { return new CursorLoader(context, uri, projection, selection, selectionArgs, sortOrder); }
From source file:com.app.uafeed.fragment.EntryFragment.java
@Override public Loader<Cursor> onCreateLoader(int id, Bundle args) { CursorLoader cursorLoader = new CursorLoader(getActivity(), EntryColumns.CONTENT_URI(mEntriesIds[id]), null, null, null, null);//from w w w . jav a2 s. co m cursorLoader.setUpdateThrottle(1000); return cursorLoader; }
From source file:us.theparamountgroup.android.inventory.EditorActivity.java
@Override public Loader<Cursor> onCreateLoader(int i, Bundle bundle) { // Since the editor shows all shell attributes, define a projection that contains // all columns from the pet table String[] projection = { ShellContract.ShellEntry._ID, ShellContract.ShellEntry.COLUMN_SHELL_NAME, ShellContract.ShellEntry.COLUMN_SHELL_COLOR, ShellContract.ShellEntry.COLUMN_SHELL_HOLE, ShellContract.ShellEntry.COLUMN_SHELL_TYPE, ShellContract.ShellEntry.COLUMN_SHELL_QUANTITY, ShellContract.ShellEntry.COLUMN_SHELL_PRICE, ShellContract.ShellEntry.COLUMN_SHELL_PHOTO, ShellContract.ShellEntry.COLUMN_SHELL_THUMBNAIL }; // This loader will execute the ContentProvider's query method on a background thread return new CursorLoader(this, // Parent activity context mCurrentShellUri, // Query the content URI for the current shell projection, // Columns to include in the resulting Cursor null, // No selection clause null, // No selection arguments null); // Default sort order }
From source file:org.opendatakit.survey.android.fragments.InstanceUploaderListFragment.java
@Override public Loader<Cursor> onCreateLoader(int id, Bundle args) { // This is called when a new Loader needs to be created. This // sample only has one Loader, so we don't care about the ID. // First, pick the base URI to use depending on whether we are // currently filtering. Uri baseUri;//from www . j av a2 s.c o m if (((ODKActivity) getActivity()).getUploadTableId() != null) { baseUri = Uri.withAppendedPath(InstanceProviderAPI.CONTENT_URI, ((ODKActivity) getActivity()).getAppName() + "/" + ((ODKActivity) getActivity()).getUploadTableId()); } else { baseUri = Uri.withAppendedPath(InstanceProviderAPI.CONTENT_URI, ((ODKActivity) getActivity()).getAppName()); } String selection; String selectionArgs[]; String sortOrder; if (mShowUnsent) { // show all unsent or failed-sending records selection = InstanceColumns.XML_PUBLISH_STATUS + " IS NULL or " + InstanceColumns.XML_PUBLISH_STATUS + "=?"; selectionArgs = new String[] { InstanceColumns.STATUS_SUBMISSION_FAILED }; sortOrder = InstanceColumns.DISPLAY_NAME + " ASC"; } else { // show all completed instances (ones ready to be submitted) selection = null; selectionArgs = null; sortOrder = InstanceColumns.DISPLAY_NAME + " ASC"; } // Now create and return a CursorLoader that will take care of // creating a Cursor for the data being displayed. loader = new CursorLoader(getActivity(), baseUri, null, selection, selectionArgs, sortOrder); return loader; }
From source file:com.android.mms.quickmessage.QuickMessagePopup.java
/** * Async data loader used for loading and displaying Templates *//* w ww . j a va2 s . c o m*/ @Override public Loader<Cursor> onCreateLoader(int id, Bundle args) { return new CursorLoader(this, Template.CONTENT_URI, null, null, null, null); }
From source file:com.carlrice.reader.activity.EditFeedActivity.java
@Override public Loader<Cursor> onCreateLoader(int id, Bundle args) { CursorLoader cursorLoader = new CursorLoader(this, FilterColumns.FILTERS_FOR_FEED_CONTENT_URI(getIntent().getData().getLastPathSegment()), null, null, null, FilterColumns.IS_ACCEPT_RULE + Constants.DB_DESC); cursorLoader.setUpdateThrottle(Constants.UPDATE_THROTTLE_DELAY); return cursorLoader; }
From source file:com.teeptrak.controller.MainActivity.java
/************************************************************************************************/ @Override/* w ww.j a v a 2 s . c o m*/ public Loader<Cursor> onCreateLoader(final int id, final Bundle args) { final Uri uri = args.getParcelable(EXTRA_URI); /* * Some apps, f.e. Google Drive allow to select file that is not on the device. There is no "_data" column handled by that provider. Let's try to obtain * all columns and than check which columns are present. */ // final String[] projection = new String[] { MediaStore.MediaColumns.DISPLAY_NAME, MediaStore.MediaColumns.SIZE, MediaStore.MediaColumns.DATA }; return new CursorLoader(this, uri, null /* all columns, instead of projection */, null, null, null); }
From source file:com.sam_chordas.android.stockhawk.ui.MyStocksActivity.java
@Override public Loader<Cursor> onCreateLoader(int id, Bundle args) { // This narrows the return to only the stocks that are most current. return new CursorLoader(this, QuoteProvider.Quotes.CONTENT_URI, new String[] { QuoteColumns._ID, QuoteColumns.SYMBOL, QuoteColumns.BIDPRICE, QuoteColumns.PERCENT_CHANGE, QuoteColumns.CHANGE, QuoteColumns.ISUP }, QuoteColumns.ISCURRENT + " = ?", new String[] { "1" }, null); }
From source file:com.ezac.gliderlogs.FlightOverviewActivity.java
@Override public Loader<Cursor> onCreateLoader(int id, Bundle args) { String[] projection = { GliderLogTables.F_ID, GliderLogTables.F_DATE, GliderLogTables.F_REGISTRATION, GliderLogTables.F_CALLSIGN, GliderLogTables.F_TYPE, GliderLogTables.F_INSTRUCTION, GliderLogTables.F_PILOT, GliderLogTables.F_COPILOT, GliderLogTables.F_STARTED, GliderLogTables.F_LANDED, GliderLogTables.F_DURATION, GliderLogTables.F_LAUNCH, GliderLogTables.F_NOTES, GliderLogTables.F_SENT, GliderLogTables.F_ACK }; if (btn_select.equals("")) { selection = GliderLogTables.F_DEL + "=0"; } else {/*from ww w . j a va2 s . com*/ selection = btn_select; } // added sort criteria String sort = GliderLogTables.F_SENT + " ASC, " + GliderLogTables.F_STARTED + " DESC"; try { CursorLoader cursorLoader = new CursorLoader(this, FlightsContentProvider.CONTENT_URI_FLIGHT, projection, selection, null, sort); return cursorLoader; } catch (Exception e) { Log.d(TAG, "unable to get records, error: " + e.getMessage() + ", select:" + selection); } return null; }
From source file:com.nononsenseapps.notepad.MainActivity.java
@Override public Loader<Cursor> onCreateLoader(int id, Bundle args) { Log.d(TAG, "onCreateLoader: " + id); // This is called when a new Loader needs to be created. This // sample only has one Loader, so we don't care about the ID. Uri baseUri = NotePad.Lists.CONTENT_VISIBLE_URI; // Now create and return a CursorLoader that will take care of // creating a Cursor for the data being displayed. return new CursorLoader(this, baseUri, new String[] { NotePad.Lists._ID, NotePad.Lists.COLUMN_NAME_TITLE, NotePad.Lists.COLUMN_NAME_DELETED }, null, null, NotePad.Lists.SORT_ORDER // Use the default sort order. );/*from w w w . j a va2 s . c o m*/ }