Freigeben über


Intent.SetType(String) Method

Definition

Set an explicit MIME data type.

[Android.Runtime.Register("setType", "(Ljava/lang/String;)Landroid/content/Intent;", "GetSetType_Ljava_lang_String_Handler")]
public virtual Android.Content.Intent SetType (string? type);
[<Android.Runtime.Register("setType", "(Ljava/lang/String;)Landroid/content/Intent;", "GetSetType_Ljava_lang_String_Handler")>]
abstract member SetType : string -> Android.Content.Intent
override this.SetType : string -> Android.Content.Intent

Parameters

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

Set an explicit MIME data type.

This is used to create intents that only specify a type and not data, for example to indicate the type of data to return.

This method automatically clears any data that was previously set (for example by #setData).

<em>Note: MIME type matching in the Android framework is case-sensitive, unlike formal RFC MIME types. As a result, you should always write your MIME types with lower case letters, or use #normalizeMimeType or #setTypeAndNormalize to ensure that it is converted to lower case.</em>

Java documentation for android.content.Intent.setType(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