public class ContextWrapper extends Context
Context.BindServiceFlagsBIND_ABOVE_CLIENT, BIND_ADJUST_WITH_ACTIVITY, BIND_ALLOW_OOM_MANAGEMENT, BIND_AUTO_CREATE, BIND_DEBUG_UNBIND, BIND_FOREGROUND_SERVICE, BIND_FOREGROUND_SERVICE_WHILE_AWAKE, BIND_IMPORTANT, BIND_NOT_FOREGROUND, BIND_NOT_VISIBLE, BIND_SHOWING_UI, BIND_TREAT_LIKE_ACTIVITY, BIND_VISIBLE, BIND_WAIVE_PRIORITY, MODE_APPEND, MODE_ENABLE_WRITE_AHEAD_LOGGING, MODE_MULTI_PROCESS, MODE_PRIVATE, MODE_WORLD_READABLE, MODE_WORLD_WRITEABLE| Constructor and Description |
|---|
ContextWrapper(Context base) |
| Modifier and Type | Method and Description |
|---|---|
protected void |
attachBaseContext(Context base)
Set the base context for this ContextWrapper.
|
AssetManager |
getAssets()
Return an AssetManager instance for your application's package.
|
Context |
getBaseContext() |
File |
getDatabasePath(String name)
Returns the absolute path on the filesystem where a database created with
#openOrCreateDatabase is stored. |
File |
getFilesDir()
Returns the absolute path to the directory on the filesystem where
files created with
Context.openFileOutput(java.lang.String, int) are stored. |
PackageManager |
getPackageManager()
Return PackageManager instance to find global package information.
|
String |
getPackageName()
Return the name of this application's package.
|
Resources |
getResources()
Return a Resources instance for your application's package.
|
FileOutputStream |
openFileOutput(String name,
int mode)
Open a private file associated with this Context's application package
for writing.
|
public ContextWrapper(Context base)
protected void attachBaseContext(Context base)
base - The new base context for this wrapper.public Context getBaseContext()
public AssetManager getAssets()
Contextpublic Resources getResources()
ContextgetResources in class Contextpublic PackageManager getPackageManager()
ContextgetPackageManager in class Contextpublic String getPackageName()
ContextgetPackageName in class Contextpublic FileOutputStream openFileOutput(String name, int mode) throws FileNotFoundException
ContextNo permissions are required to invoke this method, since it uses internal storage.
openFileOutput in class Contextname - The name of the file to open; can not contain path
separators.mode - Operating mode. Use 0 or Context.MODE_PRIVATE for the
default operation, Context.MODE_APPEND to append to an existing file,
Context.MODE_WORLD_READABLE and Context.MODE_WORLD_WRITEABLE to control
permissions.FileOutputStream.FileNotFoundExceptionContext.MODE_APPEND,
Context.MODE_PRIVATE,
Context.MODE_WORLD_READABLE,
Context.MODE_WORLD_WRITEABLE,
#openFileInput,
#fileList,
#deleteFile,
FileOutputStream(String)public File getFilesDir()
ContextContext.openFileOutput(java.lang.String, int) are stored.
No permissions are required to read or write to the returned path, since this path is internal storage.
getFilesDir in class ContextContext.openFileOutput(java.lang.String, int),
#getFileStreamPath,
#getDirpublic File getDatabasePath(String name)
Context#openOrCreateDatabase is stored.getDatabasePath in class Contextname - The name of the database for which you would like to get
its path.#openOrCreateDatabase