Freigeben über


Intent Constructors

Definition

Overloads

Intent()

Create an empty intent.

Intent(Intent)

Copy constructor.

Intent(String)

Create an intent with a given action.

Intent(Context, Class)

Create an intent for a specific component.

Intent(Context, Type)
Intent(IntPtr, JniHandleOwnership)

A constructor used when creating managed representations of JNI objects; called by the runtime.

Intent(String, Uri)

Create an intent with a given action and for a given data url.

Intent(String, Uri, Context, Class)

Create an intent for a specific component with a specified action and data.

Intent(String, Uri, Context, Type)

Intent()

Create an empty intent.

[Android.Runtime.Register(".ctor", "()V", "")]
public Intent ();
Attributes

Remarks

Create an empty intent.

Java documentation for android.content.Intent.Intent().

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

Intent(Intent)

Copy constructor.

[Android.Runtime.Register(".ctor", "(Landroid/content/Intent;)V", "")]
public Intent (Android.Content.Intent? o);
[<Android.Runtime.Register(".ctor", "(Landroid/content/Intent;)V", "")>]
new Android.Content.Intent : Android.Content.Intent -> Android.Content.Intent

Parameters

o
Intent
Attributes

Remarks

Copy constructor.

Java documentation for android.content.Intent.Intent(android.content.Intent).

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

Intent(String)

Create an intent with a given action.

[Android.Runtime.Register(".ctor", "(Ljava/lang/String;)V", "")]
public Intent (string? action);
[<Android.Runtime.Register(".ctor", "(Ljava/lang/String;)V", "")>]
new Android.Content.Intent : string -> Android.Content.Intent

Parameters

action
String

The Intent action, such as ACTION_VIEW.

Attributes

Remarks

Create an intent with a given action. All other fields (data, type, class) are null. Note that the action <em>must</em> be in a namespace because Intents are used globally in the system -- for example the system VIEW action is android.intent.action.VIEW; an application's custom action would be something like com.google.app.myapp.CUSTOM_ACTION.

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

Intent(Context, Class)

Create an intent for a specific component.

[Android.Runtime.Register(".ctor", "(Landroid/content/Context;Ljava/lang/Class;)V", "")]
public Intent (Android.Content.Context? packageContext, Java.Lang.Class? cls);
[<Android.Runtime.Register(".ctor", "(Landroid/content/Context;Ljava/lang/Class;)V", "")>]
new Android.Content.Intent : Android.Content.Context * Java.Lang.Class -> Android.Content.Intent

Parameters

packageContext
Context

A Context of the application package implementing this class.

cls
Class

The component class that is to be used for the intent.

Attributes

Remarks

Create an intent for a specific component. All other fields (action, data, type, class) are null, though they can be modified later with explicit calls. This provides a convenient way to create an intent that is intended to execute a hard-coded class name, rather than relying on the system to find an appropriate class for you; see #setComponent for more information on the repercussions of this.

Java documentation for android.content.Intent.Intent(android.content.Context, java.lang.Class<?>).

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

Intent(Context, Type)

public Intent (Android.Content.Context packageContext, Type type);
new Android.Content.Intent : Android.Content.Context * Type -> Android.Content.Intent

Parameters

packageContext
Context
type
Type

Remarks

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

Intent(IntPtr, JniHandleOwnership)

A constructor used when creating managed representations of JNI objects; called by the runtime.

protected Intent (IntPtr javaReference, Android.Runtime.JniHandleOwnership transfer);
new Android.Content.Intent : nativeint * Android.Runtime.JniHandleOwnership -> Android.Content.Intent

Parameters

javaReference
IntPtr

nativeint

A IntPtrcontaining a Java Native Interface (JNI) object reference.

transfer
JniHandleOwnership

A JniHandleOwnershipindicating how to handle javaReference

Remarks

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

Intent(String, Uri)

Create an intent with a given action and for a given data url.

[Android.Runtime.Register(".ctor", "(Ljava/lang/String;Landroid/net/Uri;)V", "")]
public Intent (string? action, Android.Net.Uri? uri);
[<Android.Runtime.Register(".ctor", "(Ljava/lang/String;Landroid/net/Uri;)V", "")>]
new Android.Content.Intent : string * Android.Net.Uri -> Android.Content.Intent

Parameters

action
String

The Intent action, such as ACTION_VIEW.

uri
Uri

The Intent data URI.

Attributes

Remarks

Create an intent with a given action and for a given data url. Note that the action <em>must</em> be in a namespace because Intents are used globally in the system -- for example the system VIEW action is android.intent.action.VIEW; an application's custom action would be something like com.google.app.myapp.CUSTOM_ACTION.

<em>Note: scheme and host name matching in the Android framework is case-sensitive, unlike the formal RFC. As a result, you should always ensure that you write your Uri with these elements using lower case letters, and normalize any Uris you receive from outside of Android to ensure the scheme and host is lower case.</em>

Java documentation for android.content.Intent.Intent(java.lang.String, android.net.Uri).

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

Intent(String, Uri, Context, Class)

Create an intent for a specific component with a specified action and data.

[Android.Runtime.Register(".ctor", "(Ljava/lang/String;Landroid/net/Uri;Landroid/content/Context;Ljava/lang/Class;)V", "")]
public Intent (string? action, Android.Net.Uri? uri, Android.Content.Context? packageContext, Java.Lang.Class? cls);
[<Android.Runtime.Register(".ctor", "(Ljava/lang/String;Landroid/net/Uri;Landroid/content/Context;Ljava/lang/Class;)V", "")>]
new Android.Content.Intent : string * Android.Net.Uri * Android.Content.Context * Java.Lang.Class -> Android.Content.Intent

Parameters

action
String

The Intent action, such as ACTION_VIEW.

uri
Uri

The Intent data URI.

packageContext
Context

A Context of the application package implementing this class.

cls
Class

The component class that is to be used for the intent.

Attributes

Remarks

Create an intent for a specific component with a specified action and data. This is equivalent to using #Intent(String, android.net.Uri) to construct the Intent and then calling #setClass to set its class.

<em>Note: scheme and host name matching in the Android framework is case-sensitive, unlike the formal RFC. As a result, you should always ensure that you write your Uri with these elements using lower case letters, and normalize any Uris you receive from outside of Android to ensure the scheme and host is lower case.</em>

Java documentation for android.content.Intent.Intent(java.lang.String, android.net.Uri, android.content.Context, java.lang.Class<?>).

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

Intent(String, Uri, Context, Type)

public Intent (string action, Android.Net.Uri uri, Android.Content.Context packageContext, Type type);
new Android.Content.Intent : string * Android.Net.Uri * Android.Content.Context * Type -> Android.Content.Intent

Parameters

action
String
uri
Uri
packageContext
Context
type
Type

Remarks

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