Example usage for android.support.v4.content CursorLoader CursorLoader

List of usage examples for android.support.v4.content CursorLoader CursorLoader

Introduction

In this page you can find the example usage for android.support.v4.content CursorLoader CursorLoader.

Prototype

public CursorLoader(Context context, Uri uri, String[] projection, String selection, String[] selectionArgs,
        String sortOrder) 

Source Link

Document

Creates a fully-specified CursorLoader.

Usage

From source file:android.example.com.exampleprovider.MainActivity.java

@Override
public Loader<Cursor> onCreateLoader(int i, Bundle bundle) {
    return new CursorLoader(this, ExampleEntry.CONTENT_URI, null, null, null, null);
}

From source file:com.digiplex.extra.grantpermissiondemo.ContactsFragment.java

@Override
public Loader<Cursor> onCreateLoader(int arg0, Bundle arg1) {
    Uri baseUri;//from  w  w w  .  ja  va  2 s .co  m

    if (mCurrentFilter != null) {
        baseUri = Uri.withAppendedPath(Contacts.CONTENT_FILTER_URI, Uri.encode(mCurrentFilter));
    } else {
        baseUri = Contacts.CONTENT_URI;
    }

    String selection = "((" + Contacts.DISPLAY_NAME + " NOTNULL) AND (" + Contacts.HAS_PHONE_NUMBER
            + "=1) AND (" + Contacts.DISPLAY_NAME + " != '' ))";

    String sortOrder = ContactsContract.Contacts.DISPLAY_NAME + " COLLATE LOCALIZED ASC";

    return new CursorLoader(getActivity(), baseUri, CONTACTS_SUMMARY_PROJECTION, selection, null, sortOrder);
}

From source file:com.gbozza.android.stockhawk.ui.DetailFragment.java

@Override
public Loader<Cursor> onCreateLoader(int id, Bundle args) {
    if (null != mUri) {
        String[] selectionArgs = { mSymbol };
        return new CursorLoader(getActivity(), mUri, null, DETAIL_COLUMNS[POSITION_SYMBOL] + "=?",
                selectionArgs, null);/*from  w ww . jav  a  2  s  .com*/
    }
    return null;
}

From source file:com.ev.contactsmultipicker.ContactListFragment.java

@Override
public Loader<Cursor> onCreateLoader(int arg0, Bundle arg1) {
    return new CursorLoader(getActivity(), Contacts.CONTENT_URI, projection, selection, null,
            Contacts.DISPLAY_NAME);/*from   ww  w  . j  a  v a 2  s  .c o  m*/
}

From source file:com.jbirdvegas.mgerrit.database.FileChanges.java

/**
 * Get details for the files which we can show diff details for in the DiffViewer
 * @param context Context for database access
 * @param changeNumber The number of the change to get the file changes for
 * @return A CursorLoader//  w w w.  j  a  v  a  2s.c  om
 */
public static CursorLoader getDiffableFiles(Context context, Integer changeNumber) {
    String[] PROJECTION = new String[] { FileInfoTable.TABLE + ".rowid AS _id", C_FILE_NAME, C_ISBINARY,
            C_COMMIT_NUMBER, C_PATCH_SET_NUMBER, FileInfoTable.TABLE + "." + C_STATUS, C_LINES_INSERTED,
            C_LINES_DELETED };

    return new CursorLoader(context, CONTENT_URI, PROJECTION,
            Changes.TABLE + "." + C_COMMIT_NUMBER + " = ? AND " + FileInfoTable.TABLE + "." + C_CHANGE_ID
                    + " = " + Changes.TABLE + "." + Changes.C_CHANGE_ID + " AND (" + C_ISBINARY + " = 0 OR "
                    + C_ISIMAGE + " = 1)",
            new String[] { String.valueOf(changeNumber) }, SORT_BY);
}

From source file:com.dabay6.android.apps.carlog.ui.base.fragments.BaseEditFragment.java

/**
 * {@inheritDoc}/*from   w w  w .ja va 2 s .  com*/
 */
@Override
public Loader<Cursor> onCreateLoader(final int i, final Bundle bundle) {
    if (i == ENTITY_LOADER_ID) {
        final Uri uri = getUri().buildUpon().appendPath(entityId.toString()).build();

        return new CursorLoader(applicationContext, uri, getProjection(), null, null, null);
    }

    return null;
}

From source file:com.ksk.droidbatterybooster.provider.TimeSchedule.java

public static CursorLoader getSchedulesCursorLoader(Context context) {
    return new CursorLoader(context, CONTENT_URI, QUERY_COLUMNS, null, null, DEFAULT_SORT_ORDER);
}

From source file:com.google.android.apps.gutenberg.EditNoteFragment.java

@Override
public Loader<Cursor> onCreateLoader(int id, Bundle args) {
    String eventId = args.getString(ARG_EVENT_ID);
    String attendeeId = args.getString(ARG_ATTENDEE_ID);
    switch (id) {
    case LOADER_ATTENDEE:
        return new CursorLoader(getActivity(), Table.ATTENDEE.getItemUri(eventId, attendeeId),
                new String[] { Table.Attendee.NAME, Table.Attendee.NOTE, }, null, null, null);
    }/*from   w w w  . j  a va 2s  . c  o  m*/
    return null;
}

From source file:com.gsma.rcs.ri.messaging.GroupDeliveryInfoList.java

@Override
public Loader<Cursor> onCreateLoader(int id, Bundle arg) {
    if (LogUtils.isActive) {
        Log.d(LOGTAG, "onCreateLoader " + id);
    }/*  w  w  w.  j ava 2  s. c o  m*/
    // Create a new CursorLoader with the following query parameters.
    return new CursorLoader(this, GroupDeliveryInfoLog.CONTENT_URI, PROJECTION, WHERE_CLAUSE,
            new String[] { mMessageId }, null);
}

From source file:com.chatwing.whitelabel.fragments.ChatboxesFragment.java

@Override
public Loader<Cursor> onCreateLoader(int i, Bundle bundle) {
    return new CursorLoader(getActivity(), ChatWingContentProvider.getChatBoxesUri(),
            ChatBoxTable.getMinimumProjection(), null, null, null);
}