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.packpublishing.asynchronousandroid.chapter4.AlbumListActivitySimple.java

@Override
public Loader<Cursor> onCreateLoader(int id, Bundle args) {
    String[] columns = new String[] { MediaStore.Audio.Albums._ID, MediaStore.Audio.Albums.ARTIST,
            MediaStore.Audio.Albums.ALBUM };
    return new CursorLoader(this, MediaStore.Audio.Albums.EXTERNAL_CONTENT_URI, columns, // projection
            null, // selection
            null, // selectionArgs
            null // sortOrder
    );//from  ww  w.  j  a va  2 s .c  om
}

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

/**
 * Get details on what files changed in a change
 * @param context Context for database access
 * @param changeid The Change-Id of the change to get the file changes for
 * @return A CursorLoader//from w  ww  .j  av a  2  s.  co  m
 */
public static CursorLoader getFileChanges(Context context, String changeid) {
    return new CursorLoader(context, CONTENT_URI, PROJECTION,
            FileInfoTable.TABLE + "." + C_CHANGE_ID + " = ? AND " + FileInfoTable.TABLE + "." + C_CHANGE_ID
                    + " = " + Changes.TABLE + "." + Changes.C_CHANGE_ID,
            new String[] { changeid }, SORT_BY);
}

From source file:com.google.firebase.udacity.greenthumb.PurchaseActivity.java

@Override
public Loader<Cursor> onCreateLoader(int id, Bundle args) {
    String[] projection = { PlantEntry._ID, PlantEntry.COLUMN_NAME, PlantEntry.COLUMN_PURCHASED_QUANTITY };
    String selection = PlantEntry.COLUMN_PURCHASED_QUANTITY + " > 0";
    return new CursorLoader(this, PlantEntry.CONTENT_URI, projection, selection, null, null);
}

From source file:com.jpventura.alexandria.BookDetail.java

@Override
public android.support.v4.content.Loader<Cursor> onCreateLoader(int id, Bundle args) {
    return new CursorLoader(getActivity(), AlexandriaContract.BookEntry.buildFullBookUri(Long.parseLong(ean)),
            null, null, null, null);// w  w  w . j  av  a 2  s . c o  m
}

From source file:com.arcusapp.soundbox.data.MediaProvider.java

/**
 * Returns the name ({@linkplain MediaStore.Audio.Artists.ARTIST}) of all the Artists in the MediaStore.
 * /* w w w . ja va  2 s  .c o  m*/
 * @return list with the names
 */
public List<String> getAllArtists() {
    List<String> artists = new ArrayList<String>();

    String[] projection = { "DISTINCT " + MediaStore.Audio.Artists.ARTIST };
    String selection = MediaStore.Audio.Media.IS_MUSIC + " != 0 AND " + MediaStore.Audio.Artists.ARTIST
            + " not null ";
    String sortOrder = MediaStore.Audio.Artists.ARTIST;

    CursorLoader cl = new CursorLoader(SoundBoxApplication.getContext(), defaultDirectoryUri, projection,
            selection, null, sortOrder);
    myCursor = cl.loadInBackground();

    while (myCursor.moveToNext()) {
        artists.add(myCursor.getString(0));
    }
    myCursor.close();
    return artists;
}

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

/**
 * {@inheritDoc}//from   w w w  .  ja va2 s. c  o  m
 */
@Override
public Loader<Cursor> onCreateLoader(final int i, final Bundle bundle) {
    return new CursorLoader(getBaseContext(), Vehicle.CONTENT_URI, Vehicle.PROJECTION, null, null,
            SortOrder.DEFAULT_VEHICLE_ORDER.toString());
}

From source file:com.dmitrymalkovich.android.githubanalytics.data.source.local.LoaderProvider.java

public Loader<Cursor> createTrafficRepositoryLoader(long repositoryId) {
    return new CursorLoader(mContext, RepositoryContract.RepositoryEntry.CONTENT_URI_REPOSITORY_STARGAZERS,
            RepositoryContract.RepositoryEntry.REPOSITORY_COLUMNS_WITH_ADDITIONAL_INFO,
            RepositoryContract.RepositoryEntry.TABLE_NAME + "."
                    + RepositoryContract.RepositoryEntry.COLUMN_REPOSITORY_ID + " = ? ",
            new String[] { String.valueOf(repositoryId) }, null);
}

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

/**
 * Get the commit comments for a change/*w ww . ja v  a 2s  . c o m*/
 * @param context Context for database access
 * @param changeid The Change-Id of the change to get the comments for
 * @return A CursorLoader
 */
public static CursorLoader getMessagesForChange(Context context, String changeid) {
    return new CursorLoader(context, CONTENT_URI, PROJECTION, C_CHANGE_ID + " = ? AND " + MessageInfo.TABLE
            + "." + C_AUTHOR + " = " + Users.TABLE + "." + Users.C_ACCOUNT_ID, new String[] { changeid },
            SORT_BY);
}

From source file:com.canelmas.let.sample.ContactsActivity.java

/**
 * Initialises a new {@link CursorLoader} that queries the {@link ContactsContract}.
 *///from   ww  w.j  a v a  2  s .  com
@Override
public Loader<Cursor> onCreateLoader(int i, Bundle bundle) {
    return new CursorLoader(this, ContactsContract.Contacts.CONTENT_URI, PROJECTION, null, null, ORDER);
}

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

@Override
public Loader<Cursor> onCreateLoader(int id, Bundle args) {
    switch (id) {
    case LOADER_EVENTS: {
        return new CursorLoader(getActivity(), Table.EVENT.getBaseUri(), new String[] { Table.Event._ID, //
                Table.Event.ID, //
                Table.Event.NAME, //
                Table.Event.END_TIME, //
        }, null, null, Table.Event.END_TIME + " DESC");
    }/*w ww .j  ava2s.  c  o m*/
    }
    return null;
}