Instrumentation.GetUiAutomation(UiAutomationFlags) 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
UiAutomation
取得已設定旗標的 實例。
[Android.Runtime.Register("getUiAutomation", "(I)Landroid/app/UiAutomation;", "GetGetUiAutomation_IHandler", ApiSince=24)]
public virtual Android.App.UiAutomation? GetUiAutomation (Android.App.UiAutomationFlags flags);
[<Android.Runtime.Register("getUiAutomation", "(I)Landroid/app/UiAutomation;", "GetGetUiAutomation_IHandler", ApiSince=24)>]
abstract member GetUiAutomation : Android.App.UiAutomationFlags -> Android.App.UiAutomation
override this.GetUiAutomation : Android.App.UiAutomationFlags -> Android.App.UiAutomation
參數
- flags
- UiAutomationFlags
要傳遞至 UiAutomation 的旗標,例如 UiAutomation#FLAG_DONT_SUPPRESS_ACCESSIBILITY_SERVICES
、 UiAutomation#FLAG_DONT_USE_ACCESSIBILITY
。
傳回
UI 自動化實例。
- 屬性
備註
UiAutomation
取得已設定旗標的 實例。
<strong Note: < /strong >> :透過傳回 UiAutomation
的工作跨應用程式界限公開的 API,而檢測所公開的 API 則不會。 例如, Instrumentation#sendPointerSync(MotionEvent)
不會允許您將事件插入與檢測目標不同的應用程式中,而不論目前的應用程式為何, 都會 UiAutomation#injectInputEvent(android.view.InputEvent, boolean)
運作。
典型的測試案例應該使用 UiAutomation
或 Instrumentation
API。 同時同時使用這兩個 API 不是錯誤,而是用戶端必須注意 API 限制。
UiAutomation
如果有具有不同旗標的 ,該實例上的旗標將會變更,然後傳回它。
相容性模式:這個方法對於目標為 Build.VERSION_CODES#R
和舊版的應用程式而言是無法辨識的;針對以較新版本為目標的應用程式,如果 UiAutomation
無法連線,則會傳回 null。 呼叫端可以檢查傳回值,並重試錯誤。
的 android.app.Instrumentation.getUiAutomation(int)
JAVA 檔。
此頁面的部分是根據 原始碼專案所建立和共用的工作進行修改,並根據中所述的詞彙使用。