Example usage for android.content CursorLoader CursorLoader

List of usage examples for android.content CursorLoader CursorLoader

Introduction

In this page you can find the example usage for android.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:ru.ming13.gambit.fragment.CardsPagerFragment.java

@Override
public Loader<Cursor> onCreateLoader(int loaderId, Bundle loaderArguments) {
    String sort = String.format("%s, %s", GambitContract.Cards.ORDER_INDEX,
            GambitContract.Cards.FRONT_SIDE_TEXT);

    return new CursorLoader(getActivity(), getCardsUri(), null, null, null, sort);
}

From source file:com.espian.ticktock.AddEditActivity.java

@Override
public Loader<Cursor> onCreateLoader(int id, Bundle args) {
    return new CursorLoader(this, TickTockProvider.countdownUri, null, BaseColumns._ID + "=?",
            new String[] { editId }, null);
}

From source file:com.gmail.emerssso.srbase.ListPartsActivity.java

@Override
public Loader<Cursor> onCreateLoader(int number, Bundle bundle) {
    String[] projection = { PartTable.COLUMN_ID, PartTable.COLUMN_PART_NUMBER, PartTable.COLUMN_QUANTITY,
            PartTable.COLUMN_SOURCE, PartTable.COLUMN_USED, PartTable.COLUMN_DESCRIPTION };
    return new CursorLoader(this, SRContentProvider.PART_CONTENT_URI, projection,
            PartTable.COLUMN_SR_ID + " = ?", new String[] { srId }, null);
}

From source file:com.gmail.emerssso.srbase.ListDailiesActivity.java

@Override
public Loader<Cursor> onCreateLoader(int arg0, Bundle arg1) {
    String[] projection = { DailyTable.COLUMN_ID, DailyTable.COLUMN_DAY, DailyTable.COLUMN_MONTH,
            DailyTable.COLUMN_YEAR, DailyTable.COLUMN_COMMENT };
    return new CursorLoader(this, SRContentProvider.DAILY_CONTENT_URI, projection,
            DailyTable.COLUMN_SR_ID + " = ? ", new String[] { srId }, null);
}

From source file:de.stadtrallye.rallyesoft.ConnectionAssistantActivity.java

@Override
public Loader<Cursor> onCreateLoader(int id, Bundle args) {
    return new CursorLoader(getApplicationContext(), ContactsContract.Profile.CONTENT_URI, PROFILE_PROJECTION,
            null, null, null);/* w  w  w . ja v a2 s .  c o  m*/
}

From source file:com.silentcircle.contacts.ContactTileLoaderFactory.java

public static CursorLoader createStrequentLoader(Context context) {
    return new CursorLoader(context, Contacts.CONTENT_STREQUENT_URI, COLUMNS, null, null, STARRED_ORDER);
}

From source file:de.hshannover.f4.trust.ironcontrol.view.list_activities.ListResponsesActivity.java

@Override
protected Loader<Cursor> onCreateLoader(int id, Bundle args, ListHierarchyType type) {
    Uri uri = null;//from   w ww  . ja  va 2s  . c  o  m
    switch (type) {
    case SEARCH:
        uri = Uri.parse(DBContentProvider.SEARCH_URI + "/" + id + "/" + DBContentProvider.RESPONSES);
        break;
    case SUBSCRIPTION:
        uri = Uri.parse(DBContentProvider.SUBSCRIPTION_URI + "/" + id + "/" + DBContentProvider.RESPONSES);
        break;
    }
    CursorLoader cursorLoader = new CursorLoader(this, uri, null, null, null,
            Responses.COLUMN_DATE + " DESC, " + Responses.COLUMN_TIME + " DESC");
    return cursorLoader;
}

From source file:de.k3b.android.androFotoFinder.imagedetail.ImagePagerAdapterFromCursor.java

/**
 * Initiates a database requery in a background thread. onLoadFinished() is called when done.
 *//* www  .  j a  v a  2  s .  c  o  m*/
private void requery(final Activity context, final String[] sqlProjection, final String from,
        final String sqlWhereStatement, final String sqlSortOrder, final String... sqlWhereParameters) {

    /*
     * Initializes the CursorLoader. The MY_LOADER_ID value is eventually passed
     * to onCreateLoader().
     */

    if (SYNC) {
        // for debugging
        Cursor result = context.getContentResolver().query(Uri.parse(from), // Table to query
                sqlProjection, // Projection to return
                sqlWhereStatement, // No selection clause
                sqlWhereParameters, // No selection arguments
                sqlSortOrder // Default sort order
        );
        onLoadFinished(result);
    } else {
        final int currentLoaderId = ++MY_LOADER_ID;
        context.getLoaderManager().initLoader(currentLoaderId, null,
                new LoaderManager.LoaderCallbacks<Cursor>() {

                    @Override
                    public Loader<Cursor> onCreateLoader(int loaderID, Bundle args) {
                        if (loaderID == currentLoaderId) {
                            // Returns a new CursorLoader
                            return new CursorLoader(context, // Parent activity context
                                    Uri.parse(from), // Table to query
                                    sqlProjection, // Projection to return
                                    sqlWhereStatement, // No selection clause
                                    sqlWhereParameters, // No selection arguments
                                    sqlSortOrder // Default sort order
                            );
                        }
                        return null;
                    }

                    @Override
                    public void onLoadFinished(Loader<Cursor> loader, Cursor cursor) {
                        ImagePagerAdapterFromCursor.this.onLoadFinished(cursor);
                    }

                    @Override
                    public void onLoaderReset(Loader<Cursor> loader) {
                        ImagePagerAdapterFromCursor.this.onLoadFinished(null);
                    }
                });
    }
}

From source file:org.mars3142.android.toaster.fragment.NavigationDrawerFragment.java

@Override
public Loader<Cursor> onCreateLoader(int loaderId, Bundle args) {
    switch (loaderId) {
    case DATA_LOADER:
        return new CursorLoader(getActivity(), ToasterTable.PACKAGE_URI, null, null, null, null);

    default:/*  www.j ava2 s . c  o  m*/
        throw new IllegalArgumentException();
    }
}

From source file:com.silentcircle.contacts.ContactTileLoaderFactory.java

public static CursorLoader createStrequentPhoneOnlyLoader(Context context) {
    Uri uri = Contacts.CONTENT_STREQUENT_URI.buildUpon()
            .appendQueryParameter(ContactsContract.STREQUENT_PHONE_ONLY, "true").build();

    return new CursorLoader(context, uri, COLUMNS_PHONE_ONLY, null, null, null);
}