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.constants.ConstantsFragment.java

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

From source file:com.example.ami1.LabelDetailsActivity.java

@Override
public Loader<Cursor> onCreateLoader(int id, Bundle args) {
    final Uri labelUri = (Uri) args.getParcelable("labelUri");
    return new CursorLoader(this, labelUri, null, null, null, null);
}

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

/** {@inheritDoc} */
public Loader<Cursor> onCreateLoader(int loaderId, Bundle args) {
    switch (loaderId) {
    case LOADER_HEADER: {
        Uri uri = getIntent().getData();
        String[] projection = { Users._ID, Users.IMAGE, Users.NAME, Users.LANG };
        String selection = String.format("%s=?", JamendoContract.PARAM_IMAGE_SIZE);
        String[] selectionArgs = { getDimensionPixelSizeAsString(R.dimen.avatar_size) };
        String sortOrder = null;/*from   ww  w  .ja v a 2  s  .  co  m*/
        return new CursorLoader(this, uri, projection, selection, selectionArgs, sortOrder);
    }
    case LOADER_LIST: {
        Uri data = getIntent().getData();
        String id = data.getLastPathSegment();
        Uri uri = Albums.CONTENT_URI;
        String[] projection = { Albums._ID, Albums.IMAGE, Artists.NAME, Albums.NAME };
        String selection = String.format("%s=?&%s=?&%s=?", getColumnNameForId(id), JamendoContract.PARAM_JOIN,
                JamendoContract.PARAM_IMAGE_SIZE);
        String[] selectionArgs = { id, JamendoContract.JOIN_ALBUM_USER_STARRED,
                getDimensionPixelSizeAsString(R.dimen.image_size) };
        String sortOrder = Albums.Order.STARREDDATE.descending();
        return new CursorLoader(this, uri, projection, selection, selectionArgs, sortOrder);
    }
    default:
        return null;
    }
}

From source file:com.money.manager.ex.reports.BaseReportFragment.java

@Override
public Loader<Cursor> onCreateLoader(int id, Bundle args) {
    switch (id) {
    case ID_LOADER:
        if (args != null && args.containsKey(KEY_WHERE_CLAUSE)) {
            setWhereClause(args.getString(KEY_WHERE_CLAUSE));
        }//  w  w  w.  j  av  a  2  s. c  o m
        return new CursorLoader(getActivity(), new SQLDataSet().getUri(), null, prepareQuery(getWhereClause()),
                null, null);
    }
    return null;
}

From source file:com.android.fastinfusion.utils.db.BaseDataHelper.java

protected final CursorLoader getCursorLoader(Context context, String[] projection, String selection,
        String[] selectionArgs, String sortOrder) {
    return new CursorLoader(context, getContentUri(), projection, selection, selectionArgs, sortOrder);
}

From source file:com.enadein.carlogbook.ui.MyCarsFragment.java

@Override
public Loader<Cursor> onCreateLoader(int id, Bundle args) {
    CursorLoader cursorLoader = new CursorLoader(getActivity(), ProviderDescriptor.Car.CONTENT_URI, null, null,
            null, null);/* www  .j  ava 2s  . co  m*/

    return cursorLoader;
}

From source file:com.kyakujin.android.autoeco.ui.ManualFragment.java

@Override
public Loader<Cursor> onCreateLoader(int id, Bundle arg) {
    switch (id) {
    case ManualQuery.LOADER_ID:
        return new CursorLoader(getActivity(),
                Uri.withAppendedPath(ManualTbl.CONTENT_URI, String.valueOf(mCurrentManualId)),
                ManualQuery.PROJECTION, null, null, null);
    default://from w ww.j  a  v  a 2s.  co  m
        break;
    }
    return null;
}

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

/**
 * Get the commit message for a change/*  w ww. j ava2 s.  co m*/
 * @param context Context for database access
 * @param changeid The ID of the change to get the commit message for
 * @return A CursorLoader
 */
public static CursorLoader getCommitMessage(Context context, String changeid) {
    Uri uri = DBParams.fetchOneRow(CONTENT_URI);
    return new CursorLoader(context, uri, new String[] { C_MESSAGE }, C_CHANGE_ID + " = ?",
            new String[] { changeid }, null);
}

From source file:com.enadein.carlogbook.ui.NotificationFragment.java

@Override
public Loader<Cursor> onCreateLoader(int id, Bundle args) {
    Long carId = DBUtils.getActiveCarId(getActivity().getContentResolver());
    CursorLoader cursorLoader = new CursorLoader(getActivity(), ProviderDescriptor.Notify.CONTENT_URI, null,
            DBUtils.CAR_SELECTION_NOTIFY, new String[] { String.valueOf(carId) }, null);

    return cursorLoader;
}

From source file:cn.newgxu.android.notty.ui.UserServiceFragment.java

@Override
public Loader<Cursor> onCreateLoader(int id, Bundle args) {
    SharedPreferences prefs = NottyApplication.getApp().getPrefs();
    return new CursorLoader(getActivity(), Uri.parse(C.BASE_URI + C.NOTICES), null,
            C.notice.USER_ID + "=" + prefs.getLong(C._ID, 0), null, null);
}