Share via


Activity.ManagedQuery(Uri, String[], String, String[], String) Method

Definition

Caution

deprecated

Wrapper around ContentResolver#query(android.net.Uri , String[], String, String[], String) that gives the resulting Cursor to call #startManagingCursor so that the activity will manage its lifecycle for you.

[Android.Runtime.Register("managedQuery", "(Landroid/net/Uri;[Ljava/lang/String;Ljava/lang/String;[Ljava/lang/String;Ljava/lang/String;)Landroid/database/Cursor;", "")]
[System.Obsolete("deprecated")]
public Android.Database.ICursor? ManagedQuery (Android.Net.Uri? uri, string[]? projection, string? selection, string[]? selectionArgs, string? sortOrder);
[<Android.Runtime.Register("managedQuery", "(Landroid/net/Uri;[Ljava/lang/String;Ljava/lang/String;[Ljava/lang/String;Ljava/lang/String;)Landroid/database/Cursor;", "")>]
[<System.Obsolete("deprecated")>]
member this.ManagedQuery : Android.Net.Uri * string[] * string * string[] * string -> Android.Database.ICursor

Parameters

uri
Uri

The URI of the content provider to query.

projection
String[]

List of columns to return.

selection
String

SQL WHERE clause.

selectionArgs
String[]

The arguments to selection, if any ?s are pesent

sortOrder
String

SQL ORDER BY clause.

Returns

The Cursor that was returned by query().

Attributes

Remarks

Wrapper around ContentResolver#query(android.net.Uri , String[], String, String[], String) that gives the resulting Cursor to call #startManagingCursor so that the activity will manage its lifecycle for you.

<em>If you are targeting android.os.Build.VERSION_CODES#HONEYCOMB or later, consider instead using LoaderManager instead, available via #getLoaderManager().</em>

<strong>Warning:</strong> Do not call Cursor#close() on a cursor obtained using this method, because the activity will do that for you at the appropriate time. However, if you call #stopManagingCursor on a cursor from a managed query, the system <em>will not</em> automatically close the cursor and, in that case, you must call Cursor#close().

This member is deprecated. Use CursorLoader instead.

Java documentation for android.app.Activity.managedQuery(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

See also

  • <xref:Android.Content.ContentResolver.Query(Android.Net.Uri%2c+System.String%5b%5d%2c+System.String%5b%5d%2c+System.String%5b%5d%2c+System.String%5b%5d)>
  • StartManagingCursor(ICursor)