ActivityManager.AppTask.StartActivity(Context, Intent, 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.
Start an activity in this task.
[Android.Runtime.Register("startActivity", "(Landroid/content/Context;Landroid/content/Intent;Landroid/os/Bundle;)V", "GetStartActivity_Landroid_content_Context_Landroid_content_Intent_Landroid_os_Bundle_Handler")]
public virtual void StartActivity (Android.Content.Context? context, Android.Content.Intent? intent, Android.OS.Bundle? options);
[<Android.Runtime.Register("startActivity", "(Landroid/content/Context;Landroid/content/Intent;Landroid/os/Bundle;)V", "GetStartActivity_Landroid_content_Context_Landroid_content_Intent_Landroid_os_Bundle_Handler")>]
abstract member StartActivity : Android.Content.Context * Android.Content.Intent * Android.OS.Bundle -> unit
override this.StartActivity : Android.Content.Context * Android.Content.Intent * Android.OS.Bundle -> unit
Parameters
- context
- Context
- intent
- Intent
The Intent describing the new activity to be launched on the task.
- options
- Bundle
Optional launch options.
- Attributes
Remarks
Start an activity in this task. Brings the task to the foreground. If this task is not currently active (that is, its id < 0), then a new activity for the given Intent will be launched as the root of the task and the task brought to the foreground. Otherwise, if this task is currently active and the Intent does not specify an activity to launch in a new task, then a new activity for the given Intent will be launched on top of the task and the task brought to the foreground. If this task is currently active and the Intent specifies Intent#FLAG_ACTIVITY_NEW_TASK
or would otherwise be launched in to a new task, then the activity not launched but this task be brought to the foreground and a new intent delivered to the top activity if appropriate.
In other words, you generally want to use an Intent here that does not specify Intent#FLAG_ACTIVITY_NEW_TASK
or Intent#FLAG_ACTIVITY_NEW_DOCUMENT
, and let the system do the right thing.
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.