Android.Content.Context.CreatePackageContext Method
Return a new Context object for the given application name.

Syntax

[Android.Runtime.Register("createPackageContext", "(Ljava/lang/String;I)Landroid/content/Context;", "GetCreatePackageContext_Ljava_lang_String_IHandler")]
public abstract Context CreatePackageContext (string packageName, [Android.Runtime.GeneratedEnum] PackageContextFlags flags)

Parameters

packageName
Name of the application's package.
flags
Option flags, one of Context.CONTEXT_INCLUDE_CODE or Context.CONTEXT_IGNORE_SECURITY.

Returns

Documentation for this section has not yet been entered.

Exceptions

TypeReason
Java.Lang.SecurityException 
!:NoType:if there is no application with the given package name.
!:NoType:android/content/pm/PackageManager$NameNotFoundException;Href=../../../reference/android/content/pm/PackageManager.NameNotFoundException.html

Remarks

Return a new Context object for the given application name. This Context is the same as what the named application gets when it is launched, containing the same resources and class loader. Each call to this method returns a new instance of a Context object; Context objects are not shared, however they share common state (Resources, ClassLoader, etc) so the Context instance itself is fairly lightweight.

Throws NoType:android/content/pm/PackageManager$NameNotFoundException;Href=../../../reference/android/content/pm/PackageManager.NameNotFoundException.html if there is no application with the given package name.

Throws Java.Lang.SecurityException if the Context requested can not be loaded into the caller's process for security reasons (see Context.CONTEXT_INCLUDE_CODE for more information}.

[Android Documentation]

Requirements

Namespace: Android.Content
Assembly: Mono.Android (in Mono.Android.dll)
Assembly Versions: 0.0.0.0
Since: Added in API level 1