Condividi tramite


Instrumentation.StartActivitySync Method

Definition

Overloads

StartActivitySync(Intent)

Start a new activity and wait for it to begin running before returning.

StartActivitySync(Intent, Bundle)

Start a new activity and wait for it to begin running before returning.

StartActivitySync(Intent)

Start a new activity and wait for it to begin running before returning.

[Android.Runtime.Register("startActivitySync", "(Landroid/content/Intent;)Landroid/app/Activity;", "GetStartActivitySync_Landroid_content_Intent_Handler")]
public virtual Android.App.Activity? StartActivitySync (Android.Content.Intent? intent);
[<Android.Runtime.Register("startActivitySync", "(Landroid/content/Intent;)Landroid/app/Activity;", "GetStartActivitySync_Landroid_content_Intent_Handler")>]
abstract member StartActivitySync : Android.Content.Intent -> Android.App.Activity
override this.StartActivitySync : Android.Content.Intent -> Android.App.Activity

Parameters

intent
Intent

Description of the activity to start.

Returns

Attributes

Remarks

Start a new activity and wait for it to begin running before returning. In addition to being synchronous, this method as some semantic differences from the standard Context#startActivity call: the activity component is resolved before talking with the activity manager (its class name is specified in the Intent that this method ultimately starts), and it does not allow you to start activities that run in a different process. In addition, if the given Intent resolves to multiple activities, instead of displaying a dialog for the user to select an activity, an exception will be thrown.

The function returns as soon as the activity goes idle following the call to its Activity#onCreate. Generally this means it has gone through the full initialization including Activity#onResume and drawn and displayed its initial window.

Java documentation for android.app.Instrumentation.startActivitySync(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.

See also

Applies to

StartActivitySync(Intent, Bundle)

Start a new activity and wait for it to begin running before returning.

[Android.Runtime.Register("startActivitySync", "(Landroid/content/Intent;Landroid/os/Bundle;)Landroid/app/Activity;", "GetStartActivitySync_Landroid_content_Intent_Landroid_os_Bundle_Handler", ApiSince=28)]
public virtual Android.App.Activity StartActivitySync (Android.Content.Intent intent, Android.OS.Bundle? options);
[<Android.Runtime.Register("startActivitySync", "(Landroid/content/Intent;Landroid/os/Bundle;)Landroid/app/Activity;", "GetStartActivitySync_Landroid_content_Intent_Landroid_os_Bundle_Handler", ApiSince=28)>]
abstract member StartActivitySync : Android.Content.Intent * Android.OS.Bundle -> Android.App.Activity
override this.StartActivitySync : Android.Content.Intent * Android.OS.Bundle -> Android.App.Activity

Parameters

intent
Intent

Description of the activity to start.

options
Bundle

Additional options for how the Activity should be started. May be null if there are no options. See android.app.ActivityOptions for how to build the Bundle supplied here; there are no supported definitions for building it manually.

Returns

Attributes

Remarks

Start a new activity and wait for it to begin running before returning. In addition to being synchronous, this method as some semantic differences from the standard Context#startActivity call: the activity component is resolved before talking with the activity manager (its class name is specified in the Intent that this method ultimately starts), and it does not allow you to start activities that run in a different process. In addition, if the given Intent resolves to multiple activities, instead of displaying a dialog for the user to select an activity, an exception will be thrown.

The function returns as soon as the activity goes idle following the call to its Activity#onCreate. Generally this means it has gone through the full initialization including Activity#onResume and drawn and displayed its initial window.

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