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

Definition

Caution

deprecated

This method was deprecated in API level 15.

[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

Uri: The URI of the content provider to query.

projection
String[]

String: List of columns to return.

selection
String

String: SQL WHERE clause.

selectionArgs
String[]

String: The arguments to selection, if any ?s are pesent

sortOrder
String

String: SQL ORDER BY clause.

Returns

The Cursor that was returned by query().

Attributes

Remarks

This method was deprecated in API level 15. Use CursorLoader instead.

Wrapper around ContentResolver.query(android.net.Uri,String[],String,String[],String) that gives the resulting Cursor to call startManagingCursor(Cursor) so that the activity will manage its lifecycle for you. If you are targeting Build.VERSION_CODES.HONEYCOMB or later, consider instead using LoaderManager instead, available via getLoaderManager(). Warning: 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(Cursor) on a cursor from a managed query, the system will not automatically close the cursor and, in that case, you must call Cursor.close().

See also:

Android reference for android.app.Activity.managedQuery.

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