Context.CreateDeviceContext(Int32) 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
從目前上下文回傳一個新 Context 物件,但裝置關聯由 deviceId給出。
[Android.Runtime.Register("createDeviceContext", "(I)Landroid/content/Context;", "GetCreateDeviceContext_IHandler", ApiSince=34)]
public virtual Android.Content.Context CreateDeviceContext(int deviceId);
[<Android.Runtime.Register("createDeviceContext", "(I)Landroid/content/Context;", "GetCreateDeviceContext_IHandler", ApiSince=34)>]
abstract member CreateDeviceContext : int -> Android.Content.Context
override this.CreateDeviceContext : int -> Android.Content.Context
參數
- deviceId
- Int32
裝置的 ID 來與此情境關聯。
傳回
與該裝置 ID 相關的上下文。
- 屬性
備註
從目前上下文回傳一個新 Context 物件,但裝置關聯由 deviceId給出。 每次呼叫此方法都會回傳一個新的上下文物件實例。 上下文物件不會被共享;然而,共用狀態(例如同一配置的 及 ClassLoader 其他資源)可以共享,因此本身 Context 是輕量級的。
在虛擬裝置上執行的應用程式可使用此方法存取預設裝置的能力與功能(透過傳遞 Context#DEVICE_ID_DEFAULT. 同樣地,運行在預設裝置上的應用程式也可以存取虛擬裝置的功能。
請注意,新建立的實例會與父上下文相關的顯示相連,無論此處傳遞的裝置 ID 為何。
Java 文件 android.content.Context.createDeviceContext(int)。
本頁部分內容為基於 Open Source Project 所創建與分享的作品,並依授權條款所描述的使用進行修改。