SyncRequest.Builder.SetExtras(Bundle) Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Sets the developer-provided extras passed to the sync adapter.
[Android.Runtime.Register("setExtras", "(Landroid/os/Bundle;)Landroid/content/SyncRequest$Builder;", "GetSetExtras_Landroid_os_Bundle_Handler")]
public virtual Android.Content.SyncRequest.Builder? SetExtras(Android.OS.Bundle? bundle);
[<Android.Runtime.Register("setExtras", "(Landroid/os/Bundle;)Landroid/content/SyncRequest$Builder;", "GetSetExtras_Landroid_os_Bundle_Handler")>]
abstract member SetExtras : Android.OS.Bundle -> Android.Content.SyncRequest.Builder
override this.SetExtras : Android.OS.Bundle -> Android.Content.SyncRequest.Builder
Parameters
- bundle
- Bundle
extras bundle to set.
Returns
This builder.
- Attributes
Remarks
The bundle is copied into the request when Build() is called. Its values must be integers, longs, booleans, floats, doubles, strings, accounts, or null. An unsupported value causes Build to throw an exception.
The following example builds a request for each item, using an account and authority supplied by the caller.
var builder = new SyncRequest.Builder();
builder.SetSyncAdapter(account, authority);
builder.SyncOnce();
foreach (string item in new[] { "dog", "cat", "frog", "child" })
{
var extras = new Bundle();
extras.PutString("data", item);
builder.SetExtras(extras);
ContentResolver.RequestSync(builder.Build());
}
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.
Java documentation for android.content.SyncRequest.Builder.setExtras(android.os.Bundle).