ContentProvider.Query Method

Definition

Overloads

Query(Uri, String[], String, String[], String)

Implement this to handle query requests from clients.

Query(Uri, String[], String, String[], String, CancellationSignal)

Implement this to handle query requests from clients with support for cancellation.

Query(Uri, String[], Bundle, CancellationSignal)

Implement this to handle query requests where the arguments are packed into a Bundle.

Query(Uri, String[], String, String[], String)

Implement this to handle query requests from clients.

[Android.Runtime.Register("query", "(Landroid/net/Uri;[Ljava/lang/String;Ljava/lang/String;[Ljava/lang/String;Ljava/lang/String;)Landroid/database/Cursor;", "GetQuery_Landroid_net_Uri_arrayLjava_lang_String_Ljava_lang_String_arrayLjava_lang_String_Ljava_lang_String_Handler")]
public abstract Android.Database.ICursor? Query (Android.Net.Uri uri, string[]? projection, string? selection, string[]? selectionArgs, string? sortOrder);
[<Android.Runtime.Register("query", "(Landroid/net/Uri;[Ljava/lang/String;Ljava/lang/String;[Ljava/lang/String;Ljava/lang/String;)Landroid/database/Cursor;", "GetQuery_Landroid_net_Uri_arrayLjava_lang_String_Ljava_lang_String_arrayLjava_lang_String_Ljava_lang_String_Handler")>]
abstract member Query : Android.Net.Uri * string[] * string * string[] * string -> Android.Database.ICursor

Parameters

uri
Uri

The URI to query. This will be the full URI sent by the client; if the client is requesting a specific record, the URI will end in a record number that the implementation should parse and add to a WHERE or HAVING clause, specifying that _id value.

projection
String[]

The list of columns to put into the cursor. If null all columns are included.

selection
String

A selection criteria to apply when filtering rows. If null then all rows are included.

selectionArgs
String[]

You may include ?s in selection, which will be replaced by the values from selectionArgs, in order that they appear in the selection. The values will be bound as Strings.

sortOrder
String

How the rows in the cursor should be sorted. If null then the provider is free to define the sort order.

Returns

ICursor

a Cursor or null.

Attributes

Remarks

Java documentation for android.content.ContentProvider.query(android.net.Uri, java.lang.String[], java.lang.String, java.lang.String[], java.lang.String).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to

Query(Uri, String[], String, String[], String, CancellationSignal)

Implement this to handle query requests from clients with support for cancellation.

[Android.Runtime.Register("query", "(Landroid/net/Uri;[Ljava/lang/String;Ljava/lang/String;[Ljava/lang/String;Ljava/lang/String;Landroid/os/CancellationSignal;)Landroid/database/Cursor;", "GetQuery_Landroid_net_Uri_arrayLjava_lang_String_Ljava_lang_String_arrayLjava_lang_String_Ljava_lang_String_Landroid_os_CancellationSignal_Handler")]
public virtual Android.Database.ICursor? Query (Android.Net.Uri uri, string[]? projection, string? selection, string[]? selectionArgs, string? sortOrder, Android.OS.CancellationSignal? cancellationSignal);
[<Android.Runtime.Register("query", "(Landroid/net/Uri;[Ljava/lang/String;Ljava/lang/String;[Ljava/lang/String;Ljava/lang/String;Landroid/os/CancellationSignal;)Landroid/database/Cursor;", "GetQuery_Landroid_net_Uri_arrayLjava_lang_String_Ljava_lang_String_arrayLjava_lang_String_Ljava_lang_String_Landroid_os_CancellationSignal_Handler")>]
abstract member Query : Android.Net.Uri * string[] * string * string[] * string * Android.OS.CancellationSignal -> Android.Database.ICursor
override this.Query : Android.Net.Uri * string[] * string * string[] * string * Android.OS.CancellationSignal -> Android.Database.ICursor

Parameters

uri
Uri

The URI to query. This will be the full URI sent by the client; if the client is requesting a specific record, the URI will end in a record number that the implementation should parse and add to a WHERE or HAVING clause, specifying that _id value.

projection
String[]

The list of columns to put into the cursor. If null all columns are included.

selection
String

A selection criteria to apply when filtering rows. If null then all rows are included.

selectionArgs
String[]

You may include ?s in selection, which will be replaced by the values from selectionArgs, in order that they appear in the selection. The values will be bound as Strings.

sortOrder
String

How the rows in the cursor should be sorted. If null then the provider is free to define the sort order.

cancellationSignal
CancellationSignal

A signal to cancel the operation in progress, or null if none. If the operation is canceled, then android.os.OperationCanceledException will be thrown when the query is executed.

Returns

ICursor

a Cursor or null.

Attributes

Remarks

Java documentation for android.content.ContentProvider.query(android.net.Uri, java.lang.String[], java.lang.String, java.lang.String[], java.lang.String, android.os.CancellationSignal).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to

Query(Uri, String[], Bundle, CancellationSignal)

Implement this to handle query requests where the arguments are packed into a Bundle.

[Android.Runtime.Register("query", "(Landroid/net/Uri;[Ljava/lang/String;Landroid/os/Bundle;Landroid/os/CancellationSignal;)Landroid/database/Cursor;", "GetQuery_Landroid_net_Uri_arrayLjava_lang_String_Landroid_os_Bundle_Landroid_os_CancellationSignal_Handler", ApiSince=26)]
public virtual Android.Database.ICursor? Query (Android.Net.Uri uri, string[]? projection, Android.OS.Bundle? queryArgs, Android.OS.CancellationSignal? cancellationSignal);
[<Android.Runtime.Register("query", "(Landroid/net/Uri;[Ljava/lang/String;Landroid/os/Bundle;Landroid/os/CancellationSignal;)Landroid/database/Cursor;", "GetQuery_Landroid_net_Uri_arrayLjava_lang_String_Landroid_os_Bundle_Landroid_os_CancellationSignal_Handler", ApiSince=26)>]
abstract member Query : Android.Net.Uri * string[] * Android.OS.Bundle * Android.OS.CancellationSignal -> Android.Database.ICursor
override this.Query : Android.Net.Uri * string[] * Android.OS.Bundle * Android.OS.CancellationSignal -> Android.Database.ICursor

Parameters

uri
Uri

The URI to query. This will be the full URI sent by the client.

projection
String[]

The list of columns to put into the cursor. If null provide a default set of columns.

queryArgs
Bundle

A Bundle containing additional information necessary for the operation. Arguments may include SQL style arguments, such as ContentResolver#QUERY_ARG_SQL_LIMIT, but note that the documentation for each individual provider will indicate which arguments they support.

cancellationSignal
CancellationSignal

A signal to cancel the operation in progress, or null.

Returns

ICursor

a Cursor or null.

Attributes

Remarks

Java documentation for android.content.ContentProvider.query(android.net.Uri, java.lang.String[], android.os.Bundle, android.os.CancellationSignal).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to