Sdílet prostřednictvím


ContentProvider.Refresh(Uri, Bundle, CancellationSignal) Method

Definition

Implement this to support refresh of content identified by uri.

[Android.Runtime.Register("refresh", "(Landroid/net/Uri;Landroid/os/Bundle;Landroid/os/CancellationSignal;)Z", "GetRefresh_Landroid_net_Uri_Landroid_os_Bundle_Landroid_os_CancellationSignal_Handler", ApiSince=26)]
public virtual bool Refresh (Android.Net.Uri? uri, Android.OS.Bundle? extras, Android.OS.CancellationSignal? cancellationSignal);
[<Android.Runtime.Register("refresh", "(Landroid/net/Uri;Landroid/os/Bundle;Landroid/os/CancellationSignal;)Z", "GetRefresh_Landroid_net_Uri_Landroid_os_Bundle_Landroid_os_CancellationSignal_Handler", ApiSince=26)>]
abstract member Refresh : Android.Net.Uri * Android.OS.Bundle * Android.OS.CancellationSignal -> bool
override this.Refresh : Android.Net.Uri * Android.OS.Bundle * Android.OS.CancellationSignal -> bool

Parameters

uri
Uri

The Uri identifying the data to refresh.

extras
Bundle

Additional options from the client. The definitions of these are specific to the content provider being called.

cancellationSignal
CancellationSignal

A signal to cancel the operation in progress, or null if none. For example, if you called refresh on a particular uri, you should call CancellationSignal#throwIfCanceled() to check whether the client has canceled the refresh request.

Returns

true if the provider actually tried refreshing.

Attributes

Remarks

Implement this to support refresh of content identified by uri. By default, this method returns false; providers who wish to implement this should return true to signal the client that the provider has tried refreshing with its own implementation.

This allows clients to request an explicit refresh of content identified by uri.

Client code should only invoke this method when there is a strong indication (such as a user initiated pull to refresh gesture) that the content is stale.

Remember to send ContentResolver#notifyChange(Uri, android.database.ContentObserver) notifications when content changes.

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