ContextCompat
open class ContextCompat
kotlin.Any | |
↳ | androidx.core.content.ContextCompat |
Helper for accessing features in android.content.Context
.
Summary
Protected constructors | |
---|---|
<init>() This class should not be instantiated, but the constructor must be visible for the class to be extended (ex. in ActivityCompat). |
Public methods | |
---|---|
open static Int |
checkSelfPermission(@NonNull context: Context, @NonNull permission: String) Determine whether you have been granted a particular permission. |
open static Context? |
createDeviceProtectedStorageContext(@NonNull context: Context) Return a new Context object for the current Context but whose storage APIs are backed by device-protected storage. |
open static File! |
getCodeCacheDir(@NonNull context: Context) Returns the absolute path to the application specific cache directory on the filesystem designed for storing cached code. |
open static Int |
Returns a color associated with a particular resource ID |
open static ColorStateList? |
getColorStateList(@NonNull context: Context, @ColorRes id: Int) Returns a color state list associated with a particular resource ID. |
open static File? |
getDataDir(@NonNull context: Context) Returns the absolute path to the directory on the filesystem where all private files belonging to this app are stored. |
open static Drawable? |
getDrawable(@NonNull context: Context, @DrawableRes id: Int) Returns a drawable object associated with a particular resource ID. |
open static Array<File!> |
getExternalCacheDirs(@NonNull context: Context) Returns absolute paths to application-specific directories on all external storage devices where the application can place cache files it owns. |
open static Array<File!> |
getExternalFilesDirs(@NonNull context: Context, @Nullable type: String?) Returns absolute paths to application-specific directories on all external storage devices where the application can place persistent files it owns. |
open static Executor! |
getMainExecutor(context: Context!) Return an |
open static File? |
getNoBackupFilesDir(@NonNull context: Context) Returns the absolute path to the directory on the filesystem similar to |
open static Array<File!> |
getObbDirs(@NonNull context: Context) Returns absolute paths to application-specific directories on all external storage devices where the application's OBB files (if there are any) can be found. |
open static T? |
getSystemService(@NonNull context: Context, @NonNull serviceClass: Class<T>) Return the handle to a system-level service by class. |
open static String? |
getSystemServiceName(@NonNull context: Context, @NonNull serviceClass: Class<*>) Gets the name of the system-level service that is represented by the specified class. |
open static Boolean |
isDeviceProtectedStorage(@NonNull context: Context) Indicates if the storage APIs of this Context are backed by device-encrypted storage. |
open static Boolean |
startActivities(@NonNull context: Context, @NonNull intents: Array<Intent!>) Start a set of activities as a synthesized task stack, if able. |
open static Boolean |
startActivities(@NonNull context |