次の方法で共有


Context.CreateContextForSplit(String) Method

Definition

Return a new Context object for the given split name.

[Android.Runtime.Register("createContextForSplit", "(Ljava/lang/String;)Landroid/content/Context;", "GetCreateContextForSplit_Ljava_lang_String_Handler", ApiSince=26)]
public abstract Android.Content.Context? CreateContextForSplit (string? splitName);
[<Android.Runtime.Register("createContextForSplit", "(Ljava/lang/String;)Landroid/content/Context;", "GetCreateContextForSplit_Ljava_lang_String_Handler", ApiSince=26)>]
abstract member CreateContextForSplit : string -> Android.Content.Context

Parameters

splitName
String

The name of the split to include, as declared in the split's AndroidManifest.xml.

Returns

A Context with the given split's code and/or resources loaded.

Attributes

Remarks

Return a new Context object for the given split name. The new Context has a ClassLoader and Resources object that can access the split's and all of its dependencies' code/resources. Each call to this method returns a new instance of a Context object; Context objects are not shared, however common state (ClassLoader, other Resources for the same split) may be so the Context itself can be fairly lightweight.

Java documentation for android.content.Context.createContextForSplit(java.lang.String).

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