語言

Context.StartInstrumentation(ComponentName, String, Bundle) 方法

定義

開始執行一個 android.app.Instrumentation 類別。

[Android.Runtime.Register("startInstrumentation", "(Landroid/content/ComponentName;Ljava/lang/String;Landroid/os/Bundle;)Z", "GetStartInstrumentation_Landroid_content_ComponentName_Ljava_lang_String_Landroid_os_Bundle_Handler")]
public abstract bool StartInstrumentation(Android.Content.ComponentName className, string? profileFile, Android.OS.Bundle? arguments);
[<Android.Runtime.Register("startInstrumentation", "(Landroid/content/ComponentName;Ljava/lang/String;Landroid/os/Bundle;)Z", "GetStartInstrumentation_Landroid_content_ComponentName_Ljava_lang_String_Landroid_os_Bundle_Handler")>]
abstract member StartInstrumentation : Android.Content.ComponentName * string * Android.OS.Bundle -> bool

參數

className
ComponentName

要執行的儀器元件名稱。

profileFile
String

可選路徑在儀器執行時寫入剖析資料,或為空路徑表示不剖析。

arguments
Bundle

額外的可選參數可傳遞給儀器,或稱為空。

傳回

true 如果儀器成功啟動,否則 false 找不到儀器。

屬性

備註

開始執行一個 android.app.Instrumentation 類別。 該 Instrumentation 元件將透過終止目標應用程式(若目前正在執行)來執行,啟動目標程序,實例化該儀器元件,然後讓它驅動應用程式。

此功能並非同步式——當儀器啟動且運行中時,它會立即返回。

儀器化通常只能對未簽章或以該儀表套件也簽署的簽章(確保目標信任該儀表)的套件執行。

Java 文件 android.content.Context.startInstrumentation(android.content.ComponentName, java.lang.String, android.os.Bundle)。

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

適用於