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:com.commonsware.android.calllog.consumer.CallLogConsumerActivity.java

@Override
public Loader<Cursor> onCreateLoader(int loaderId, Bundle args) {
    return (new CursorLoader(this, CallLog.Calls.CONTENT_URI, PROJECTION, null, null,
            CallLog.Calls.DATE + " DESC"));
}

From source file:com.emetophobe.permissionviewer.fragments.PermissionListFragment.java

/**
 * Create the permission list loader.//from   ww w  . j  ava 2  s . c o  m
 */
@Override
public Loader<Cursor> onCreateLoader(int id, Bundle args) {
    setLoading(true);

    // Create the selection clause.
    String selection = Permissions.PERMISSION_NAME + " IS NOT NULL";
    if (!SettingsHelper.getShowSystemApps(getActivity())) {
        selection += " AND " + Permissions.IS_SYSTEM + " = 0";
    }

    // Get the permission sort order preference and set the sort order.
    String sortOrder = SettingsHelper.getPermissionSortOrder(getActivity()) ? SORT_BY_PERMISSION_NAME
            : SORT_BY_COUNT;

    // Create the loader.
    return new CursorLoader(getActivity(), Permissions.PERMISSIONS_URI,
            new String[] { Permissions._ID, Permissions.PERMISSION_NAME, Permissions.APP_NAME, APP_COUNT },
            selection, null, sortOrder);
}

From source file:com.commonsware.android.cal.query.CalendarQueryActivity.java

public Loader<Cursor> onCreateLoader(int loaderId, Bundle args) {
    return (new CursorLoader(this, CalendarContract.Events.CONTENT_URI, PROJECTION, null, null,
            CalendarContract.Events.DTSTART));
}

From source file:com.andremion.louvre.data.MediaLoader.java

@Override
public final Loader<Cursor> onCreateLoader(int id, Bundle args) {
    if (id == TIME_LOADER) {
        return new CursorLoader(mActivity, GALLERY_URI, ALL_IMAGE_PROJECTION, mTypeFilter, null,
                MEDIA_SORT_ORDER);//from   w w  w.j a v a  2  s. c  om
    }
    if (id == BUCKET_LOADER) {
        return new CursorLoader(mActivity, GALLERY_URI, BUCKET_PROJECTION,
                String.format("%s AND %s", mTypeFilter, BUCKET_SELECTION), null, BUCKET_SORT_ORDER);
    }
    // id == MEDIA_LOADER
    return new CursorLoader(
            mActivity, GALLERY_URI, IMAGE_PROJECTION, String.format("%s=%s AND %s",
                    MediaStore.Images.Media.BUCKET_ID, args.getLong(BUCKET_ID), mTypeFilter),
            null, MEDIA_SORT_ORDER);
}

From source file:com.google.android.demos.jamendo.app.TagActivity.java

/** {@inheritDoc} */
public Loader<Cursor> onCreateLoader(int loaderId, Bundle args) {
    switch (loaderId) {
    case LOADER_HEADER: {
        Uri uri = getIntent().getData();
        String[] projection = { Tags._ID, Tags.IDSTR, Tags.NAME };
        String selection = null;/*from w  w  w  .java  2s  . c  o  m*/
        String[] selectionArgs = null;
        String sortOrder = null;
        return new CursorLoader(this, uri, projection, selection, selectionArgs, sortOrder);
    }
    case LOADER_LIST: {
        String idstr = getIntent().getData().getLastPathSegment();
        Uri uri = Albums.CONTENT_URI;
        String[] projection = { Albums._ID, Albums.IMAGE, Artists.NAME, Albums.NAME, Albums.GENRE };
        String selection = String.format("%s=?", Tags.IDSTR);
        String[] selectionArgs = { idstr };
        String sortOrder = Albums.Order.RATINGMONTH.descending();
        return new CursorLoader(this, uri, projection, selection, selectionArgs, sortOrder);
    }
    default:
        return null;
    }
}

From source file:com.bangz.smartmute.RuleEditActivity.java

@Override
public Loader onCreateLoader(int id, Bundle args) {
    return new CursorLoader(this, mUri, PROJECTS, "", null, null);
}

From source file:com.commonsware.android.loader.ConstantsBrowser.java

public Loader<Cursor> onCreateLoader(int loaderId, Bundle args) {
    return (new CursorLoader(this, Provider.Constants.CONTENT_URI, PROJECTION, null, null, null));
}

From source file:com.gerolab.sdksample.StepsLogActivity.java

@Override
public Loader<Cursor> onCreateLoader(int id, Bundle bundle) {
    return new CursorLoader(
            getApplicationContext(), StepsProvider.CONTENT_URI, new String[] { TableSteps.COLUMN_ID,
                    TableSteps.COLUMN_STEPS, TableSteps.COLUMN_CALORIES, TableSteps.COLUMN_DISTANCE },
            null, null, null);/*from  w ww.j  av a2s  .c  om*/
}

From source file:com.emetophobe.permissionviewer.activities.PermissionDetailActivity.java

@Override
public Loader<Cursor> onCreateLoader(int id, Bundle args) {
    String selection = Permissions.PERMISSION_NAME + "=?";
    if (!SettingsHelper.getShowSystemApps(this)) {
        selection += " AND " + Permissions.IS_SYSTEM + "=0";
    }//from  w ww .  jav a  2s.co m

    return new CursorLoader(this, Permissions.CONTENT_URI, PROJECTION, selection,
            new String[] { mPermissionName }, SORT_ORDER);
}

From source file:com.battlelancer.seriesguide.ui.MoviesWatchListFragment.java

@Override
public Loader<Cursor> onCreateLoader(int loaderId, Bundle args) {
    return new CursorLoader(getActivity(), Movies.CONTENT_URI, MoviesCursorAdapter.MoviesQuery.PROJECTION,
            Movies.SELECTION_WATCHLIST, null, MoviesDistillationSettings.getSortQuery(getActivity()));
}