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.blandware.android.atleap.loader.SimpleCursorAdapterLoadable.java

/**
 * Instantiate and return a new Loader for the given ID.
 *
 * @param id The ID whose loader is to be created.
 * @param args Any arguments supplied by the caller.
 * @return Return a new Loader instance that is ready to start loading.
 *//*from   w ww.j av a  2 s  .com*/
@Override
public Loader<Cursor> onCreateLoader(int id, Bundle args) {
    return new CursorLoader(mContext, mUri, mProjection, mSelection, mSelectionArgs, mSortOrder);
}

From source file:com.itime.team.itime.fragments.MeetingPreferenceFragment.java

@Override
public Loader<Cursor> onCreateLoader(int id, Bundle args) {
    return new CursorLoader(getActivity(), ITimeDataStore.Preference.CONTENT_URI, null, null, null, null);
}

From source file:com.dmitrymalkovich.android.popularmoviesapp.MovieListActivity.java

@Override
public Loader<Cursor> onCreateLoader(int i, Bundle bundle) {
    findViewById(R.id.progress).setVisibility(View.VISIBLE);
    return new CursorLoader(this, MovieContract.MovieEntry.CONTENT_URI, MovieContract.MovieEntry.MOVIE_COLUMNS,
            null, null, null);//  www .  jav  a2s .  c om
}

From source file:com.julia.android.stockhawk.ui.StockDetailActivity.java

@Override
public Loader<Cursor> onCreateLoader(int id, Bundle args) {
    return new CursorLoader(this, Contract.Quote.uri, Contract.Quote.QUOTE_COLUMNS,
            Contract.Quote.COLUMN_SYMBOL + "=?", new String[] { symbol }, Contract.Quote.COLUMN_SYMBOL);
}

From source file:com.murrayc.galaxyzoo.app.SubjectViewerFragment.java

@Override
public Loader<Cursor> onCreateLoader(final int loaderId, final Bundle bundle) {
    if (loaderId != URL_LOADER) {
        return null;
    }/* ww  w. j  av a2 s  .  c o  m*/
    final String itemId = getItemId();
    if (TextUtils.isEmpty(itemId)) {
        return null;
    }

    //Asynchronously get the actual ID,
    //because we have just asked for the "next" item.
    final Activity activity = getActivity();

    final Uri.Builder builder = Item.CONTENT_URI.buildUpon();
    builder.appendPath(itemId);

    showLoadingView(true);

    return new CursorLoader(activity, builder.build(), mColumns, null, // No where clause, return all records. We already specify just one via the itemId in the URI
            null, // No where clause, therefore no where column values.
            null // Use the default sort order.
    );
}

From source file:com.fbartnitzek.tasteemall.location.ShowProducerMapFragment.java

@Override
public Loader<Cursor> onCreateLoader(int id, Bundle args) {
    //        Log.v(LOG_TAG, "onCreateLoader, hashCode=" + this.hashCode() + ", " + "id = [" + id + "], args = [" + args + "]");
    switch (id) {
    case PRODUCERS_LOADER_ID:
        return new CursorLoader(getActivity(), mBaseUri, QueryColumns.MapFragment.ProducerLocations.COLUMNS,
                null, null, null);/* w w  w.  j  a v a2 s  .c  o m*/
    case REVIEWS_OF_PRODUCER_LOADER_ID:
        return new CursorLoader(getActivity(), mReviewsOfProducerUri,
                QueryColumns.MapFragment.ReviewsSubQuery.COLUMNS, null, null, null);
    default:
        throw new RuntimeException(
                "wrong loaderId in " + ShowProducerMapFragment.class.getSimpleName() + ": " + id);
    }
}

From source file:com.airg.android.permission.sample.DangerousFragment.java

@Override
public Loader<Cursor> onCreateLoader(final int id, final Bundle args) {
    final Activity activity = getActivity();

    if (null == activity || LOADER_LAST_CALL != id)
        return null;

    return new CursorLoader(activity, CallLog.Calls.CONTENT_URI, new String[] { CallLog.Calls.NUMBER },
            CallLog.Calls.TYPE + "=? OR " + CallLog.Calls.TYPE + "=?", new String[] {
                    String.valueOf(CallLog.Calls.INCOMING_TYPE), String.valueOf(CallLog.Calls.MISSED_TYPE) },
            CallLog.Calls.DATE + " DESC");
}

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

/**
 * Returns the id ({@linkplain MediaStore.Audio.Playlists.Members.AUDIO_ID}) of all the Songs of the specified Playlist in the MediaStore.
 * //  w  w w .  j  a v a  2  s.c o m
 * @param playListID ({@linkplain MediaStore.Audio.Playlists._ID})
 * @return list with the ids
 */
public List<String> getSongsFromPlaylist(String playListID) {
    List<String> ids = new ArrayList<String>();

    Uri specialUri = MediaStore.Audio.Playlists.Members.getContentUri("external", Integer.parseInt(playListID));
    String[] projection = { MediaStore.Audio.Playlists.Members.AUDIO_ID,
            MediaStore.Audio.Playlists.Members.TITLE };
    String sortOrder = MediaStore.Audio.Playlists.Members.TITLE;

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

    while (myCursor.moveToNext()) {
        ids.add(myCursor.getString(0));
    }

    myCursor.close();
    return ids;
}

From source file:com.julia.android.stockhawk.ui.MainActivity.java

@Override
public Loader<Cursor> onCreateLoader(int id, Bundle args) {
    return new CursorLoader(this, Contract.Quote.uri, Contract.Quote.QUOTE_COLUMNS, null, null,
            Contract.Quote.COLUMN_SYMBOL);
}

From source file:com.bangz.shotrecorder.MainActivity.java

@Override
public Loader<Cursor> onCreateLoader(int id, Bundle args) {
    String select = new String();
    return new CursorLoader(this, getIntent().getData(), PROJECTION, select, null, null);
}