Share via


Intent.SetDataAndType(Uri, String) Method

Definition

(Usually optional) Set the data for the intent along with an explicit MIME data type.

[Android.Runtime.Register("setDataAndType", "(Landroid/net/Uri;Ljava/lang/String;)Landroid/content/Intent;", "GetSetDataAndType_Landroid_net_Uri_Ljava_lang_String_Handler")]
public virtual Android.Content.Intent SetDataAndType (Android.Net.Uri? data, string? type);
[<Android.Runtime.Register("setDataAndType", "(Landroid/net/Uri;Ljava/lang/String;)Landroid/content/Intent;", "GetSetDataAndType_Landroid_net_Uri_Ljava_lang_String_Handler")>]
abstract member SetDataAndType : Android.Net.Uri * string -> Android.Content.Intent
override this.SetDataAndType : Android.Net.Uri * string -> Android.Content.Intent

Parameters

data
Uri

The Uri of the data this intent is now targeting.

type
String

The MIME type of the data being handled by this intent.

Returns

Returns the same Intent object, for chaining multiple calls into a single statement.

Attributes

Remarks

(Usually optional) Set the data for the intent along with an explicit MIME data type. This method should very rarely be used -- it allows you to override the MIME type that would ordinarily be inferred from the data with your own type given here.

<em>Note: MIME type and Uri scheme matching in the Android framework is case-sensitive, unlike the formal RFC definitions. As a result, you should always write these elements with lower case letters, or use #normalizeMimeType or android.net.Uri#normalizeScheme or #setDataAndTypeAndNormalize to ensure that they are converted to lower case.</em>

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