Compartir a través de


PendingIntent.GetActivity Method

Definition

Overloads

GetActivity(Context, Int32, Intent, PendingIntentFlags)

Retrieve a PendingIntent that will start a new activity, like calling Context#startActivity(Intent) Context.startActivity(Intent).

GetActivity(Context, Int32, Intent, PendingIntentFlags, Bundle)

Retrieve a PendingIntent that will start a new activity, like calling Context#startActivity(Intent) Context.startActivity(Intent).

GetActivity(Context, Int32, Intent, PendingIntentFlags)

Retrieve a PendingIntent that will start a new activity, like calling Context#startActivity(Intent) Context.startActivity(Intent).

[Android.Runtime.Register("getActivity", "(Landroid/content/Context;ILandroid/content/Intent;I)Landroid/app/PendingIntent;", "")]
public static Android.App.PendingIntent? GetActivity (Android.Content.Context? context, int requestCode, Android.Content.Intent? intent, Android.App.PendingIntentFlags flags);
[<Android.Runtime.Register("getActivity", "(Landroid/content/Context;ILandroid/content/Intent;I)Landroid/app/PendingIntent;", "")>]
static member GetActivity : Android.Content.Context * int * Android.Content.Intent * Android.App.PendingIntentFlags -> Android.App.PendingIntent

Parameters

context
Context

The Context in which this PendingIntent should start the activity.

requestCode
Int32

Private request code for the sender

intent
Intent

Intent of the activity to be launched.

flags
PendingIntentFlags

May be #FLAG_ONE_SHOT, #FLAG_NO_CREATE, #FLAG_CANCEL_CURRENT, #FLAG_UPDATE_CURRENT, or any of the flags as supported by Intent#fillIn Intent.fillIn() to control which unspecified parts of the intent that can be supplied when the actual send happens.

Returns

Returns an existing or new PendingIntent matching the given parameters. May return null only if #FLAG_NO_CREATE has been supplied.

Attributes

Remarks

Retrieve a PendingIntent that will start a new activity, like calling Context#startActivity(Intent) Context.startActivity(Intent). Note that the activity will be started outside of the context of an existing activity, so you must use the Intent#FLAG_ACTIVITY_NEW_TASK Intent.FLAG_ACTIVITY_NEW_TASK launch flag in the Intent.

<p class="note">For security reasons, the android.content.Intent you supply here should almost always be an <em>explicit intent</em>, that is specify an explicit component to be delivered to through Intent#setClass(android.content.Context, Class) Intent.setClass</p>

Java documentation for android.app.PendingIntent.getActivity(android.content.Context, int, android.content.Intent, int).

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

GetActivity(Context, Int32, Intent, PendingIntentFlags, Bundle)

Retrieve a PendingIntent that will start a new activity, like calling Context#startActivity(Intent) Context.startActivity(Intent).

[Android.Runtime.Register("getActivity", "(Landroid/content/Context;ILandroid/content/Intent;ILandroid/os/Bundle;)Landroid/app/PendingIntent;", "")]
public static Android.App.PendingIntent? GetActivity (Android.Content.Context? context, int requestCode, Android.Content.Intent intent, Android.App.PendingIntentFlags flags, Android.OS.Bundle? options);
[<Android.Runtime.Register("getActivity", "(Landroid/content/Context;ILandroid/content/Intent;ILandroid/os/Bundle;)Landroid/app/PendingIntent;", "")>]
static member GetActivity : Android.Content.Context * int * Android.Content.Intent * Android.App.PendingIntentFlags * Android.OS.Bundle -> Android.App.PendingIntent

Parameters

context
Context

The Context in which this PendingIntent should start the activity.

requestCode
Int32

Private request code for the sender

intent
Intent

Intent of the activity to be launched.

flags
PendingIntentFlags

May be #FLAG_ONE_SHOT, #FLAG_NO_CREATE, #FLAG_CANCEL_CURRENT, #FLAG_UPDATE_CURRENT, or any of the flags as supported by Intent#fillIn Intent.fillIn() to control which unspecified parts of the intent that can be supplied when the actual send happens.

options
Bundle

Additional options for how the Activity should be started. May be null if there are no options.

Returns

Returns an existing or new PendingIntent matching the given parameters. May return null only if #FLAG_NO_CREATE has been supplied.

Attributes

Remarks

Retrieve a PendingIntent that will start a new activity, like calling Context#startActivity(Intent) Context.startActivity(Intent). Note that the activity will be started outside of the context of an existing activity, so you must use the Intent#FLAG_ACTIVITY_NEW_TASK Intent.FLAG_ACTIVITY_NEW_TASK launch flag in the Intent.

<p class="note">For security reasons, the android.content.Intent you supply here should almost always be an <em>explicit intent</em>, that is specify an explicit component to be delivered to through Intent#setClass(android.content.Context, Class) Intent.setClass</p>

Java documentation for android.app.PendingIntent.getActivity(android.content.Context, int, android.content.Intent, int, android.os.Bundle).

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