Example usage for android.content ContentResolver query

List of usage examples for android.content ContentResolver query

Introduction

In this page you can find the example usage for android.content ContentResolver query.

Prototype

public final @Nullable Cursor query(final @RequiresPermission.Read @NonNull Uri uri,
        @Nullable String[] projection, @Nullable Bundle queryArgs,
        @Nullable CancellationSignal cancellationSignal) 

Source Link

Document

Query the given URI, returning a Cursor over the result set with support for cancellation.

Usage

From source file:android.support.content.Query.java

@Nullable
Cursor run(@NonNull ContentResolver resolver) {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
        return resolver.query(mUri, mProjection, mQueryArgs, mCancellationSignal);
    }//from  w w w. j  ava2s  .  c o m

    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
        if (DEBUG)
            Log.d(TAG, "Falling back to pre-O query method.");
        return resolver.query(mUri, mProjection, null, null, null, mCancellationSignal);
    }

    if (DEBUG)
        Log.d(TAG, "Falling back to pre-jellybean query method.");
    return resolver.query(mUri, mProjection, null, null, null);
}