Udostępnij za pośrednictwem


ContentProvider.Delete Method

Definition

Overloads

Delete(Uri, Bundle)

Implement this to handle requests to delete one or more rows.

Delete(Uri, String, String[])

Implement this to handle requests to delete one or more rows.

Delete(Uri, Bundle)

Implement this to handle requests to delete one or more rows.

[Android.Runtime.Register("delete", "(Landroid/net/Uri;Landroid/os/Bundle;)I", "GetDelete_Landroid_net_Uri_Landroid_os_Bundle_Handler", ApiSince=30)]
public virtual int Delete (Android.Net.Uri uri, Android.OS.Bundle? extras);
[<Android.Runtime.Register("delete", "(Landroid/net/Uri;Landroid/os/Bundle;)I", "GetDelete_Landroid_net_Uri_Landroid_os_Bundle_Handler", ApiSince=30)>]
abstract member Delete : Android.Net.Uri * Android.OS.Bundle -> int
override this.Delete : Android.Net.Uri * Android.OS.Bundle -> int

Parameters

uri
Uri

The full URI to query, including a row ID (if a specific record is requested).

extras
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.

Returns

Attributes

Remarks

Implement this to handle requests to delete one or more rows. The implementation should apply the selection clause when performing deletion, allowing the operation to affect multiple rows in a directory. As a courtesy, call ContentResolver#notifyChange(android.net.Uri ,android.database.ContentObserver) notifyChange() after deleting. This method can be called from multiple threads, as described in Processes and Threads.

The implementation is responsible for parsing out a row ID at the end of the URI, if a specific row is being deleted. That is, the client would pass in content://contacts/people/22 and the implementation is responsible for parsing the record number (22) when creating a SQL statement.

Java documentation for android.content.ContentProvider.delete(android.net.Uri, android.os.Bundle).

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

Delete(Uri, String, String[])

Implement this to handle requests to delete one or more rows.

[Android.Runtime.Register("delete", "(Landroid/net/Uri;Ljava/lang/String;[Ljava/lang/String;)I", "GetDelete_Landroid_net_Uri_Ljava_lang_String_arrayLjava_lang_String_Handler")]
public abstract int Delete (Android.Net.Uri uri, string? selection, string[]? selectionArgs);
[<Android.Runtime.Register("delete", "(Landroid/net/Uri;Ljava/lang/String;[Ljava/lang/String;)I", "GetDelete_Landroid_net_Uri_Ljava_lang_String_arrayLjava_lang_String_Handler")>]
abstract member Delete : Android.Net.Uri * string * string[] -> int

Parameters

uri
Uri

The full URI to query, including a row ID (if a specific record is requested).

selection
String

An optional restriction to apply to rows when deleting.

selectionArgs
String[]

Returns

The number of rows affected.

Attributes

Exceptions

Remarks

Implement this to handle requests to delete one or more rows. The implementation should apply the selection clause when performing deletion, allowing the operation to affect multiple rows in a directory. As a courtesy, call ContentResolver#notifyChange(android.net.Uri ,android.database.ContentObserver) notifyChange() after deleting. This method can be called from multiple threads, as described in Processes and Threads.

The implementation is responsible for parsing out a row ID at the end of the URI, if a specific row is being deleted. That is, the client would pass in content://contacts/people/22 and the implementation is responsible for parsing the record number (22) when creating a SQL statement.

Java documentation for android.content.ContentProvider.delete(android.net.Uri, 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