語言

Instrumentation.NewActivity 方法

定義

多載

NewActivity(Class, Context, IBinder, Application, Intent, ActivityInfo, String, Activity, String, Object)

執行物件實例 Activity 化。

public Android.App.Activity? NewActivity(Java.Lang.Class? clazz, Android.Content.Context? context, Android.OS.IBinder? token, Android.App.Application? application, Android.Content.Intent? intent, Android.Content.PM.ActivityInfo? info, string? title, Android.App.Activity? parent, string? id, Java.Lang.Object? lastNonConfigurationInstance);
member this.NewActivity : Java.Lang.Class * Android.Content.Context * Android.OS.IBinder * Android.App.Application * Android.Content.Intent * Android.Content.PM.ActivityInfo * string * Android.App.Activity * string * Java.Lang.Object -> Android.App.Activity

參數

clazz
Class

所期望活動的類別

context
Context

活動的基礎上下文

token
IBinder

此活動的通訊憑證

application
Application

應用程式物件(若有的話)

intent
Intent

這場活動的意圖

info
ActivityInfo

清單上的活動資訊

title
String

標題通常取自 ActivityInfo 記錄

parent
Activity

父活動(如有)

id
String

嵌入的 ID(如果有的話)

lastNonConfigurationInstance
Object

任意物件,將透過 Activity#getLastNonConfigurationInstance() Activity.getLastNonConfigurationInstance()提供。

傳回

回傳實例化的活動

備註

這種過載是為了單元測試而設計的。 此活動可在本地使用,但缺少系統內使用所需的部分連結。

Android 參考資料。android.app.Instrumentation.newActivity

本頁部分內容為基於 Open Source Project 所創建與分享的作品,並依授權條款所描述的使用進行修改。

適用於

NewActivity(Class, Context, IBinder, Application, Intent, ActivityInfo, ICharSequence, Activity, String, Object)

執行物件實例 Activity 化。

[Android.Runtime.Register("newActivity", "(Ljava/lang/Class;Landroid/content/Context;Landroid/os/IBinder;Landroid/app/Application;Landroid/content/Intent;Landroid/content/pm/ActivityInfo;Ljava/lang/CharSequence;Landroid/app/Activity;Ljava/lang/String;Ljava/lang/Object;)Landroid/app/Activity;", "GetNewActivity_Ljava_lang_Class_Landroid_content_Context_Landroid_os_IBinder_Landroid_app_Application_Landroid_content_Intent_Landroid_content_pm_ActivityInfo_Ljava_lang_CharSequence_Landroid_app_Activity_Ljava_lang_String_Ljava_lang_Object_Handler")]
public virtual Android.App.Activity? NewActivity(Java.Lang.Class? clazz, Android.Content.Context? context, Android.OS.IBinder? token, Android.App.Application? application, Android.Content.Intent? intent, Android.Content.PM.ActivityInfo? info, Java.Lang.ICharSequence? title, Android.App.Activity? parent, string? id, Java.Lang.Object? lastNonConfigurationInstance);
[<Android.Runtime.Register("newActivity", "(Ljava/lang/Class;Landroid/content/Context;Landroid/os/IBinder;Landroid/app/Application;Landroid/content/Intent;Landroid/content/pm/ActivityInfo;Ljava/lang/CharSequence;Landroid/app/Activity;Ljava/lang/String;Ljava/lang/Object;)Landroid/app/Activity;", "GetNewActivity_Ljava_lang_Class_Landroid_content_Context_Landroid_os_IBinder_Landroid_app_Application_Landroid_content_Intent_Landroid_content_pm_ActivityInfo_Ljava_lang_CharSequence_Landroid_app_Activity_Ljava_lang_String_Ljava_lang_Object_Handler")>]
abstract member NewActivity : Java.Lang.Class * Android.Content.Context * Android.OS.IBinder * Android.App.Application * Android.Content.Intent * Android.Content.PM.ActivityInfo * Java.Lang.ICharSequence * Android.App.Activity * string * Java.Lang.Object -> Android.App.Activity
override this.NewActivity : Java.Lang.Class * Android.Content.Context * Android.OS.IBinder * Android.App.Application * Android.Content.Intent * Android.Content.PM.ActivityInfo * Java.Lang.ICharSequence * Android.App.Activity * string * Java.Lang.Object -> Android.App.Activity

參數

clazz
Class

所期望活動的類別

context
Context

活動的基礎上下文

token
IBinder

此活動的通訊憑證

application
Application

應用程式物件(若有的話)

intent
Intent

這場活動的意圖

info
ActivityInfo

清單上的活動資訊

title
ICharSequence

標題通常取自 ActivityInfo 記錄

parent
Activity

父活動(如有)

id
String

嵌入的 ID(如果有的話)

lastNonConfigurationInstance
Object

任意物件,將透過 Activity#getLastNonConfigurationInstance() Activity.getLastNonConfigurationInstance()提供。

傳回

回傳實例化的活動

屬性

備註

執行一個活動物件的實例化。 此方法用於單元測試,例如 android.test.ActivityUnitTestCase。 活動可在本地使用,但會缺少系統內使用所需的部分連結。

擲出:IllegalAccessException

擲出:InstantiationException

Android 參考資料。android.app.Instrumentation.newActivity

本頁部分內容為基於 Open Source Project 所創建與分享的作品,並依授權條款所描述的使用進行修改。

適用於

NewActivity(ClassLoader, String, Intent)

執行進程的 Activity 物件具現化。

[Android.Runtime.Register("newActivity", "(Ljava/lang/ClassLoader;Ljava/lang/String;Landroid/content/Intent;)Landroid/app/Activity;", "GetNewActivity_Ljava_lang_ClassLoader_Ljava_lang_String_Landroid_content_Intent_Handler")]
public virtual Android.App.Activity? NewActivity(Java.Lang.ClassLoader? cl, string? className, Android.Content.Intent? intent);
[<Android.Runtime.Register("newActivity", "(Ljava/lang/ClassLoader;Ljava/lang/String;Landroid/content/Intent;)Landroid/app/Activity;", "GetNewActivity_Ljava_lang_ClassLoader_Ljava_lang_String_Landroid_content_Intent_Handler")>]
abstract member NewActivity : Java.Lang.ClassLoader * string * Android.Content.Intent -> Android.App.Activity
override this.NewActivity : Java.Lang.ClassLoader * string * Android.Content.Intent -> Android.App.Activity

參數

cl
ClassLoader

用來實例化物件的 ClassLoader。

className
String

這是實作 Activity 物件的類別名稱。

intent
Intent

就是指定要實例化的活動類別的 Intent 物件。

傳回

新實例化的 Activity 物件。

屬性

備註

執行程序的 Activity 物件實例化。 預設實作提供正常的系統行為。

擲出:ClassNotFoundException

擲出:IllegalAccessException

擲出:InstantiationException

Android 參考資料。android.app.Instrumentation.newActivity

本頁部分內容為基於 Open Source Project 所創建與分享的作品,並依授權條款所描述的使用進行修改。

適用於