public abstractContextcreatePackageContext(StringpackageName, int flags)
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.
ThrowsPackageManager.NameNotFoundException
if there is no application with the given package name.
ThrowsSecurityException
if the Context requested can not be loaded into the caller's process for security reasons (seeCONTEXT_INCLUDE_CODE
for more information}.
Parameters
packageName | Name of the application's package. |
---|---|
flags | Option flags, one ofCONTEXT_INCLUDE_CODE orCONTEXT_IGNORE_SECURITY . |
Returns
- A Context for the application.
Throws
java.lang.SecurityException | |
if there is no application with the given package name | |
PackageManager.NameNotFoundException |