added in [version 22.1.0](https://developer.android.com/topic/libraries/support-library/revisions)   
belongs to Maven artifact com.android.support:support-compat:28.0.0-alpha1 Summary: [Protected Ctors](https://developer.android.com/reference/android/support/v4/content/ContextCompat#proctors) \| [Methods](https://developer.android.com/reference/android/support/v4/content/ContextCompat#pubmethods) \| [Inherited Methods](https://developer.android.com/reference/android/support/v4/content/ContextCompat#inhmethods) \| [\[Expand All\]](https://developer.android.com/reference/android/support/v4/content/ContextCompat#)

# ContextCompat


`
public


class
ContextCompat
`


`

extends Object


`

`


`

|---|---|
| java.lang.Object ||
| ↳ | android.support.v4.content.ContextCompat |

[![](https://developer.android.com/static/assets/images/styles/disclosure_down.png)](https://developer.android.com/reference/android/support/v4/content/ContextCompat#)Known Direct Subclasses [ActivityCompat](https://developer.android.com/reference/android/support/v4/app/ActivityCompat) [ActivityCompat](https://developer.android.com/reference/android/support/v4/app/ActivityCompat) Helper for accessing features in `https://developer.android.com/reference/android/app/Activity.html`. [![](https://developer.android.com/static/assets/images/styles/disclosure_down.png)](https://developer.android.com/reference/android/support/v4/content/ContextCompat#)Known Indirect Subclasses [ActivityCompat](https://developer.android.com/reference/android/support/v13/app/ActivityCompat) [ActivityCompat](https://developer.android.com/reference/android/support/v13/app/ActivityCompat) *This class was deprecated
in API level 27.1.0.
Use `https://developer.android.com/reference/android/support/v4/app/ActivityCompat`.*   

*** ** * ** ***

Helper for accessing features in `https://developer.android.com/reference/android/content/Context.html`.

## Summary

| ### Protected constructors ||
|---|---|
| ` https://developer.android.com/reference/android/support/v4/content/ContextCompat#ContextCompat()() ` This class should not be instantiated, but the constructor must be visible for the class to be extended (ex. |

| ### Public methods ||
|---|---|
| ` static int` | ` https://developer.android.com/reference/android/support/v4/content/ContextCompat#checkSelfPermission(android.content.Context, java.lang.String)(https://developer.android.com/reference/android/content/Context.html context, String permission) ` Determine whether *you* have been granted a particular permission. |
| ` static https://developer.android.com/reference/android/content/Context.html` | ` https://developer.android.com/reference/android/support/v4/content/ContextCompat#createDeviceProtectedStorageContext(android.content.Context)(https://developer.android.com/reference/android/content/Context.html context) ` Return a new Context object for the current Context but whose storage APIs are backed by device-protected storage. |
| ` static File` | ` https://developer.android.com/reference/android/support/v4/content/ContextCompat#getCodeCacheDir(android.content.Context)(https://developer.android.com/reference/android/content/Context.html context) ` Returns the absolute path to the application specific cache directory on the filesystem designed for storing cached code. |
| ` static int` | ` https://developer.android.com/reference/android/support/v4/content/ContextCompat#getColor(android.content.Context, int)(https://developer.android.com/reference/android/content/Context.html context, int id) ` Returns a color associated with a particular resource ID Starting in `https://developer.android.com/reference/android/os/Build.VERSION_CODES.html#M`, the returned color will be styled for the specified Context's theme. |
| ` static https://developer.android.com/reference/android/content/res/ColorStateList.html` | ` https://developer.android.com/reference/android/support/v4/content/ContextCompat#getColorStateList(android.content.Context, int)(https://developer.android.com/reference/android/content/Context.html context, int id) ` Returns a color state list associated with a particular resource ID. |
| ` static File` | ` https://developer.android.com/reference/android/support/v4/content/ContextCompat#getDataDir(android.content.Context)(https://developer.android.com/reference/android/content/Context.html context) ` Returns the absolute path to the directory on the filesystem where all private files belonging to this app are stored. |
| ` static https://developer.android.com/reference/android/graphics/drawable/Drawable.html` | ` https://developer.android.com/reference/android/support/v4/content/ContextCompat#getDrawable(android.content.Context, int)(https://developer.android.com/reference/android/content/Context.html context, int id) ` Returns a drawable object associated with a particular resource ID. |
| ` static File[]` | ` https://developer.android.com/reference/android/support/v4/content/ContextCompat#getExternalCacheDirs(android.content.Context)(https://developer.android.com/reference/android/content/Context.html context) ` Returns absolute paths to application-specific directories on all external storage devices where the application can place cache files it owns. |
| ` static File[]` | ` https://developer.android.com/reference/android/support/v4/content/ContextCompat#getExternalFilesDirs(android.content.Context, java.lang.String)(https://developer.android.com/reference/android/content/Context.html context, String type) ` Returns absolute paths to application-specific directories on all external storage devices where the application can place persistent files it owns. |
| ` static File` | ` https://developer.android.com/reference/android/support/v4/content/ContextCompat#getNoBackupFilesDir(android.content.Context)(https://developer.android.com/reference/android/content/Context.html context) ` Returns the absolute path to the directory on the filesystem similar to `https://developer.android.com/reference/android/content/Context.html#getFilesDir()`. |
| ` static File[]` | ` https://developer.android.com/reference/android/support/v4/content/ContextCompat#getObbDirs(android.content.Context)(https://developer.android.com/reference/android/content/Context.html 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. |
| ` static <T> T` | ` https://developer.android.com/reference/android/support/v4/content/ContextCompat#getSystemService(android.content.Context, java.lang.Class<T>)(https://developer.android.com/reference/android/content/Context.html context, Class<T> serviceClass) ` Return the handle to a system-level service by class. |
| ` static String` | ` https://developer.android.com/reference/android/support/v4/content/ContextCompat#getSystemServiceName(android.content.Context, java.lang.Class<?>)(https://developer.android.com/reference/android/content/Context.html context, Class<?> serviceClass) ` Gets the name of the system-level service that is represented by the specified class. |
| ` static boolean` | ` https://developer.android.com/reference/android/support/v4/content/ContextCompat#isDeviceProtectedStorage(android.content.Context)(https://developer.android.com/reference/android/content/Context.html context) ` Indicates if the storage APIs of this Context are backed by device-encrypted storage. |
| ` static boolean` | ` https://developer.android.com/reference/android/support/v4/content/ContextCompat#startActivities(android.content.Context, android.content.Intent[], android.os.Bundle)(https://developer.android.com/reference/android/content/Context.html context, https://developer.android.com/reference/android/content/Intent.html intents, https://developer.android.com/reference/android/os/Bundle.html options) ` Start a set of activities as a synthesized task stack, if able. |
| ` static boolean` | ` https://developer.android.com/reference/android/support/v4/content/ContextCompat#startActivities(android.content.Context, android.content.Intent[])(https://developer.android.com/reference/android/content/Context.html context, https://developer.android.com/reference/android/content/Intent.html intents) ` Start a set of activities as a synthesized task stack, if able. |
| ` static void` | ` https://developer.android.com/reference/android/support/v4/content/ContextCompat#startActivity(android.content.Context, android.content.Intent, android.os.Bundle)(https://developer.android.com/reference/android/content/Context.html context, https://developer.android.com/reference/android/content/Intent.html intent, https://developer.android.com/reference/android/os/Bundle.html options) ` Start an activity with additional launch information, if able. |
| ` static void` | ` https://developer.android.com/reference/android/support/v4/content/ContextCompat#startForegroundService(android.content.Context, android.content.Intent)(https://developer.android.com/reference/android/content/Context.html context, https://developer.android.com/reference/android/content/Intent.html intent) ` startForegroundService() was introduced in O, just call startService for before O. |

### Inherited methods

[![](https://developer.android.com/static/assets/images/styles/disclosure_down.png)](https://developer.android.com/reference/android/support/v4/content/ContextCompat#)From class `

java.lang.Object

` `


Object` `
clone()
` `


boolean` `
equals(Object arg0)
` `


void` `
finalize()
` `


final

Class<?>` `
getClass()
` `


int` `
hashCode()
` `


final

void` `
notify()
` `


final

void` `
notifyAll()
` `


String` `
toString()
` `


final

void` `
wait(long arg0, int arg1)
` `


final

void` `
wait(long arg0)
` `


final

void` `
wait()
`

## Protected constructors

### ContextCompat

added in [version 22.1.0](https://developer.android.com/topic/libraries/support-library/revisions)

```
ContextCompat ()
```

This class should not be instantiated, but the constructor must be
visible for the class to be extended (ex. in ActivityCompat).

<br />

## Public methods

### checkSelfPermission

added in [version 24.1.0](https://developer.android.com/topic/libraries/support-library/revisions)

```
int checkSelfPermission (Context context, 
                String permission)
```

Determine whether *you* have been granted a particular permission.

<br />

| Parameters ||
|---|---|
| `context` | `Context` <br /> |
| `permission` | `String`: The name of the permission being checked. <br /> |

| Returns ||
|---|---|
| `int` | `https://developer.android.com/reference/android/content/pm/PackageManager.html#PERMISSION_GRANTED` if you have the permission, or `https://developer.android.com/reference/android/content/pm/PackageManager.html#PERMISSION_DENIED` if not. <br /> |

**See also:**

- `https://developer.android.com/https://developer.android.com/reference/android/content/pm/PackageManager#checkPermission(java.lang.String, java.lang.String)`

### createDeviceProtectedStorageContext

added in [version 24.1.0](https://developer.android.com/topic/libraries/support-library/revisions)

```
Context createDeviceProtectedStorageContext (Context context)
```

Return a new Context object for the current Context but whose storage
APIs are backed by device-protected storage.


On devices with direct boot, data stored in this location is encrypted
with a key tied to the physical device, and it can be accessed
immediately after the device has booted successfully, both
*before and after* the user has authenticated with their
credentials (such as a lock pattern or PIN).


Because device-protected data is available without user authentication,
you should carefully limit the data you store using this Context. For
example, storing sensitive authentication tokens or passwords in the
device-protected area is strongly discouraged.


If the underlying device does not have the ability to store
device-protected and credential-protected data using different keys, then
both storage areas will become available at the same time. They remain as
two distinct storage locations on disk, and only the window of
availability changes.


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 configuration) may be so the Context itself can be
fairly lightweight.


Prior to API 24 this method returns
`null`, since device-protected storage is not available.

<br />

| Parameters ||
|---|---|
| `context` | `Context` <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/content/Context.html` | <br /> |

**See also:**

- `https://developer.android.com/reference/android/support/v4/content/ContextCompat#isDeviceProtectedStorage(android.content.Context)`

### getCodeCacheDir

added in [version 22.1.0](https://developer.android.com/topic/libraries/support-library/revisions)

```
File getCodeCacheDir (Context context)
```

Returns the absolute path to the application specific cache directory on
the filesystem designed for storing cached code. On devices running
`https://developer.android.com/reference/android/os/Build.VERSION_CODES.html#LOLLIPOP` or later, the system will delete
any files stored in this location both when your specific application is
upgraded, and when the entire platform is upgraded.


This location is optimal for storing compiled or optimized code generated
by your application at runtime.


Apps require no extra permissions to read or write to the returned path,
since this path lives in their private storage.

<br />

| Parameters ||
|---|---|
| `context` | `Context` <br /> |

| Returns ||
|---|---|
| `File` | The path of the directory holding application code cache files. <br /> |

### getColor

added in [version 24.1.0](https://developer.android.com/topic/libraries/support-library/revisions)

```
int getColor (Context context, 
                int id)
```

Returns a color associated with a particular resource ID


Starting in `https://developer.android.com/reference/android/os/Build.VERSION_CODES.html#M`, the returned
color will be styled for the specified Context's theme.

<br />

| Parameters ||
|---|---|
| `context` | `Context` <br /> |
| `id` | `int`: The desired resource identifier, as generated by the aapt tool. This integer encodes the package, type, and resource entry. The value 0 is an invalid identifier. <br /> |

| Returns ||
|---|---|
| `int` | A single color value in the form 0xAARRGGBB. <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/android/content/res/Resources.NotFoundException.html` | if the given ID does not exist. |

### getColorStateList

added in [version 24.1.0](https://developer.android.com/topic/libraries/support-library/revisions)

```
ColorStateList getColorStateList (Context context, 
                int id)
```

Returns a color state list associated with a particular resource ID.


Starting in `https://developer.android.com/reference/android/os/Build.VERSION_CODES.html#M`, the returned
color state list will be styled for the specified Context's theme.

<br />

| Parameters ||
|---|---|
| `context` | `Context` <br /> |
| `id` | `int`: The desired resource identifier, as generated by the aapt tool. This integer encodes the package, type, and resource entry. The value 0 is an invalid identifier. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/content/res/ColorStateList.html` | A color state list, or `null` if the resource could not be resolved. <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/android/content/res/Resources.NotFoundException.html` | if the given ID does not exist. |

### getDataDir

added in [version 24.1.0](https://developer.android.com/topic/libraries/support-library/revisions)

```
File getDataDir (Context context)
```

Returns the absolute path to the directory on the filesystem where all
private files belonging to this app are stored. Apps should not use this
path directly; they should instead use `https://developer.android.com/reference/android/content/Context.html#getFilesDir()`,
`https://developer.android.com/reference/android/content/Context.html#getCacheDir()`, `https://developer.android.com/reference/android/content/Context.html#getDir(java.lang.String, int)`, or
other storage APIs on `https://developer.android.com/reference/android/content/Context.html`.


The returned path may change over time if the calling app is moved to an
adopted storage device, so only relative paths should be persisted.


No additional permissions are required for the calling app to read or
write files under the returned path.

<br />

| Parameters ||
|---|---|
| `context` | `Context` <br /> |

| Returns ||
|---|---|
| `File` | <br /> |

**See also:**

- `https://developer.android.com/https://developer.android.com/reference/android/content/pm/ApplicationInfo#dataDir`

### getDrawable

added in [version 22.1.0](https://developer.android.com/topic/libraries/support-library/revisions)

```
Drawable getDrawable (Context context, 
                int id)
```

Returns a drawable object associated with a particular resource ID.


Starting in `https://developer.android.com/reference/android/os/Build.VERSION_CODES.html#LOLLIPOP`, the
returned drawable will be styled for the specified Context's theme.

<br />

| Parameters ||
|---|---|
| `context` | `Context` <br /> |
| `id` | `int`: The desired resource identifier, as generated by the aapt tool. This integer encodes the package, type, and resource entry. The value 0 is an invalid identifier. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/graphics/drawable/Drawable.html` | Drawable An object that can be used to draw this resource. <br /> |

### getExternalCacheDirs

added in [version 22.1.0](https://developer.android.com/topic/libraries/support-library/revisions)

```
File[] getExternalCacheDirs (Context context)
```

Returns absolute paths to application-specific directories on all
external storage devices where the application can place cache files it
owns. These files are internal to the application, and not typically
visible to the user as media.


This is like `https://developer.android.com/reference/android/content/Context.html#getCacheDir()` in that these files will be
deleted when the application is uninstalled, however there are some
important differences:

- External files are not always available: they will disappear if the user mounts the external storage on a computer or removes it.
- There is no security enforced with these files.


External storage devices returned here are considered a permanent part of
the device, including both emulated external storage and physical media
slots, such as SD cards in a battery compartment. The returned paths do
not include transient devices, such as USB flash drives.


An application may store data on any or all of the returned devices. For
example, an app may choose to store large files on the device with the
most available space, as measured by `https://developer.android.com/reference/android/os/StatFs.html`.


Starting in `https://developer.android.com/reference/android/os/Build.VERSION_CODES.html#KITKAT`, no permissions
are required to write to the returned paths; they're always accessible to
the calling app. Before then,
`https://developer.android.com/reference/android/Manifest.permission#WRITE_EXTERNAL_STORAGE` is required to
write. Write access outside of these paths on secondary external storage
devices is not available. To request external storage access in a
backwards compatible way, consider using `android:maxSdkVersion`
like this:

```
<uses-permission
     android:name="android.permission.WRITE_EXTERNAL_STORAGE"
     android:maxSdkVersion="18" />
```


The first path returned is the same as
`https://developer.android.com/reference/android/content/Context.html#getExternalCacheDir()`. Returned paths may be `null`
if a storage device is unavailable.

<br />

| Parameters ||
|---|---|
| `context` | `Context` <br /> |

| Returns ||
|---|---|
| `File[]` | <br /> |

**See also:**

- `https://developer.android.com/https://developer.android.com/reference/android/content/Context#getExternalCacheDir()`
- `https://developer.android.com/reference/android/support/v4/os/EnvironmentCompat#getStorageState(java.io.File)`

### getExternalFilesDirs

added in [version 22.1.0](https://developer.android.com/topic/libraries/support-library/revisions)

```
File[] getExternalFilesDirs (Context context, 
                String type)
```

Returns absolute paths to application-specific directories on all
external storage devices where the application can place persistent files
it owns. These files are internal to the application, and not typically
visible to the user as media.


This is like `https://developer.android.com/reference/android/content/Context.html#getFilesDir()` in that these files will be
deleted when the application is uninstalled, however there are some
important differences:

- External files are not always available: they will disappear if the user mounts the external storage on a computer or removes it.
- There is no security enforced with these files.


External storage devices returned here are considered a permanent part of
the device, including both emulated external storage and physical media
slots, such as SD cards in a battery compartment. The returned paths do
not include transient devices, such as USB flash drives.


An application may store data on any or all of the returned devices. For
example, an app may choose to store large files on the device with the
most available space, as measured by `https://developer.android.com/reference/android/os/StatFs.html`.


Starting in `https://developer.android.com/reference/android/os/Build.VERSION_CODES.html#KITKAT`, no permissions
are required to write to the returned paths; they're always accessible to
the calling app. Before then,
`https://developer.android.com/reference/android/Manifest.permission#WRITE_EXTERNAL_STORAGE` is required to
write. Write access outside of these paths on secondary external storage
devices is not available. To request external storage access in a
backwards compatible way, consider using `android:maxSdkVersion`
like this:

```
<uses-permission
     android:name="android.permission.WRITE_EXTERNAL_STORAGE"
     android:maxSdkVersion="18" />
```


The first path returned is the same as
`https://developer.android.com/reference/android/content/Context.html#getExternalFilesDir(java.lang.String)`. Returned paths may be
`null` if a storage device is unavailable.

<br />

| Parameters ||
|---|---|
| `context` | `Context` <br /> |
| `type` | `String` <br /> |

| Returns ||
|---|---|
| `File[]` | <br /> |

**See also:**

- `https://developer.android.com/https://developer.android.com/reference/android/content/Context#getExternalFilesDir(java.lang.String)`
- `https://developer.android.com/reference/android/support/v4/os/EnvironmentCompat#getStorageState(java.io.File)`

### getNoBackupFilesDir

added in [version 22.1.0](https://developer.android.com/topic/libraries/support-library/revisions)

```
File getNoBackupFilesDir (Context context)
```

Returns the absolute path to the directory on the filesystem similar to
`https://developer.android.com/reference/android/content/Context.html#getFilesDir()`. The difference is that files placed under this
directory will be excluded from automatic backup to remote storage on
devices running `https://developer.android.com/reference/android/os/Build.VERSION_CODES.html#LOLLIPOP` or later.

No permissions are required to read or write to the returned path, since this
path is internal storage.

<br />

| Parameters ||
|---|---|
| `context` | `Context` <br /> |

| Returns ||
|---|---|
| `File` | The path of the directory holding application files that will not be automatically backed up to remote storage. <br /> |

**See also:**

- `https://developer.android.com/https://developer.android.com/reference/android/content/Context#getFilesDir()`

### getObbDirs

added in [version 22.1.0](https://developer.android.com/topic/libraries/support-library/revisions)

```
File[] getObbDirs (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. Note if the application does not have any OBB files,
these directories may not exist.


This is like `https://developer.android.com/reference/android/content/Context.html#getFilesDir()` in that these files will be
deleted when the application is uninstalled, however there are some
important differences:

- External files are not always available: they will disappear if the user mounts the external storage on a computer or removes it.
- There is no security enforced with these files.


External storage devices returned here are considered a permanent part of
the device, including both emulated external storage and physical media
slots, such as SD cards in a battery compartment. The returned paths do
not include transient devices, such as USB flash drives.


An application may store data on any or all of the returned devices. For
example, an app may choose to store large files on the device with the
most available space, as measured by `https://developer.android.com/reference/android/os/StatFs.html`.


Starting in `https://developer.android.com/reference/android/os/Build.VERSION_CODES.html#KITKAT`, no permissions
are required to write to the returned paths; they're always accessible to
the calling app. Before then,
`https://developer.android.com/reference/android/Manifest.permission#WRITE_EXTERNAL_STORAGE` is required to
write. Write access outside of these paths on secondary external storage
devices is not available. To request external storage access in a
backwards compatible way, consider using `android:maxSdkVersion`
like this:

```
<uses-permission
     android:name="android.permission.WRITE_EXTERNAL_STORAGE"
     android:maxSdkVersion="18" />
```


The first path returned is the same as `https://developer.android.com/reference/android/content/Context.html#getObbDir()`.
Returned paths may be `null` if a storage device is unavailable.

<br />

| Parameters ||
|---|---|
| `context` | `Context` <br /> |

| Returns ||
|---|---|
| `File[]` | <br /> |

**See also:**

- `https://developer.android.com/https://developer.android.com/reference/android/content/Context#getObbDir()`
- `https://developer.android.com/reference/android/support/v4/os/EnvironmentCompat#getStorageState(java.io.File)`

### getSystemService

```
T getSystemService (Context context, 
                Class<T> serviceClass)
```

Return the handle to a system-level service by class.

<br />

| Parameters ||
|---|---|
| `context` | `Context`: Context to retrieve service from. <br /> |
| `serviceClass` | `Class`: The class of the desired service. <br /> |

| Returns ||
|---|---|
| `T` | The service or null if the class is not a supported system service. <br /> |

**See also:**

- `https://developer.android.com/https://developer.android.com/reference/android/content/Context#getSystemService(java.lang.Class<T>)`

### getSystemServiceName

```
String getSystemServiceName (Context context, 
                Class<?> serviceClass)
```

Gets the name of the system-level service that is represented by the specified class.

<br />

| Parameters ||
|---|---|
| `context` | `Context`: Context to retrieve service name from. <br /> |
| `serviceClass` | `Class`: The class of the desired service. <br /> |

| Returns ||
|---|---|
| `String` | The service name or null if the class is not a supported system service. <br /> |

**See also:**

- `https://developer.android.com/https://developer.android.com/reference/android/content/Context#getSystemServiceName(java.lang.Class<?>)`

### isDeviceProtectedStorage

added in [version 24.1.0](https://developer.android.com/topic/libraries/support-library/revisions)

```
boolean isDeviceProtectedStorage (Context context)
```

Indicates if the storage APIs of this Context are backed by
device-encrypted storage.

<br />

| Parameters ||
|---|---|
| `context` | `Context` <br /> |

| Returns ||
|---|---|
| `boolean` | <br /> |

**See also:**

- `https://developer.android.com/reference/android/support/v4/content/ContextCompat#createDeviceProtectedStorageContext(android.content.Context)`

### startActivities

added in [version 22.1.0](https://developer.android.com/topic/libraries/support-library/revisions)

```
boolean startActivities (Context context, 
                Intent[] intents, 
                Bundle options)
```

Start a set of activities as a synthesized task stack, if able.

In API level 11 (Android 3.0/Honeycomb) the recommended conventions for
app navigation using the back key changed. The back key's behavior is local
to the current task and does not capture navigation across different tasks.
Navigating across tasks and easily reaching the previous task is accomplished
through the "recents" UI, accessible through the software-provided Recents key
on the navigation or system bar. On devices with the older hardware button configuration
the recents UI can be accessed with a long press on the Home key.

When crossing from one task stack to another post-Android 3.0,
the application should synthesize a back stack/history for the new task so that
the user may navigate out of the new task and back to the Launcher by repeated
presses of the back key. Back key presses should not navigate across task stacks.

startActivities provides a mechanism for constructing a synthetic task stack of
multiple activities. If the underlying API is not available on the system this method
will return false.

<br />

<br />

| Parameters ||
|---|---|
| `context` | `Context`: Start activities using this activity as the starting context <br /> |
| `intents` | `Intent`: Array of intents defining the activities that will be started. The element length-1 will correspond to the top activity on the resulting task stack. <br /> |
| `options` | `Bundle`: Additional options for how the Activity should be started. See `https://developer.android.com/reference/android/content/Context.html#startActivity(android.content.Intent, android.os.Bundle)` <br /> |

| Returns ||
|---|---|
| `boolean` | true if the underlying API was available and the call was successful, false otherwise <br /> |

### startActivities

added in [version 22.1.0](https://developer.android.com/topic/libraries/support-library/revisions)

```
boolean startActivities (Context context, 
                Intent[] intents)
```

Start a set of activities as a synthesized task stack, if able.

In API level 11 (Android 3.0/Honeycomb) the recommended conventions for
app navigation using the back key changed. The back key's behavior is local
to the current task and does not capture navigation across different tasks.
Navigating across tasks and easily reaching the previous task is accomplished
through the "recents" UI, accessible through the software-provided Recents key
on the navigation or system bar. On devices with the older hardware button configuration
the recents UI can be accessed with a long press on the Home key.

When crossing from one task stack to another post-Android 3.0,
the application should synthesize a back stack/history for the new task so that
the user may navigate out of the new task and back to the Launcher by repeated
presses of the back key. Back key presses should not navigate across task stacks.

startActivities provides a mechanism for constructing a synthetic task stack of
multiple activities. If the underlying API is not available on the system this method
will return false.

<br />

<br />

| Parameters ||
|---|---|
| `context` | `Context`: Start activities using this activity as the starting context <br /> |
| `intents` | `Intent`: Array of intents defining the activities that will be started. The element length-1 will correspond to the top activity on the resulting task stack. <br /> |

| Returns ||
|---|---|
| `boolean` | true if the underlying API was available and the call was successful, false otherwise <br /> |

### startActivity

added in [version 25.1.0](https://developer.android.com/topic/libraries/support-library/revisions)

```
void startActivity (Context context, 
                Intent intent, 
                Bundle options)
```

Start an activity with additional launch information, if able.

In Android 4.1+ additional options were introduced to allow for more
control on activity launch animations. Applications can use this method
along with `https://developer.android.com/reference/android/support/v4/app/ActivityOptionsCompat` to use these animations when
available. When run on versions of the platform where this feature does
not exist the activity will be launched normally.

<br />

<br />

| Parameters ||
|---|---|
| `context` | `Context`: Context to launch activity from. <br /> |
| `intent` | `Intent`: The description of the activity to start. <br /> |
| `options` | `Bundle`: Additional options for how the Activity should be started. May be null if there are no options. See `https://developer.android.com/reference/android/support/v4/app/ActivityOptionsCompat` for how to build the Bundle supplied here; there are no supported definitions for building it manually. <br /> |

### startForegroundService

added in [version 26.1.0](https://developer.android.com/topic/libraries/support-library/revisions)

```
void startForegroundService (Context context, 
                Intent intent)
```

startForegroundService() was introduced in O, just call startService
for before O.

<br />

| Parameters ||
|---|---|
| `context` | `Context`: Context to start Service from. <br /> |
| `intent` | `Intent`: The description of the Service to start. <br /> |

**See also:**

- `https://developer.android.com/`
- `https://developer.android.com/`
-

  ## Interfaces

  - [Loader.OnLoadCanceledListener](https://developer.android.com/reference/android/support/v4/content/Loader.OnLoadCanceledListener)
  - [Loader.OnLoadCompleteListener](https://developer.android.com/reference/android/support/v4/content/Loader.OnLoadCompleteListener)
-

  ## Classes

  - [AsyncTaskLoader](https://developer.android.com/reference/android/support/v4/content/AsyncTaskLoader)
  - [ContentResolverCompat](https://developer.android.com/reference/android/support/v4/content/ContentResolverCompat)
  - [ContextCompat](https://developer.android.com/reference/android/support/v4/content/ContextCompat)
  - [CursorLoader](https://developer.android.com/reference/android/support/v4/content/CursorLoader)
  - [FileProvider](https://developer.android.com/reference/android/support/v4/content/FileProvider)
  - [IntentCompat](https://developer.android.com/reference/android/support/v4/content/IntentCompat)
  - [Loader](https://developer.android.com/reference/android/support/v4/content/Loader)
  - [Loader.ForceLoadContentObserver](https://developer.android.com/reference/android/support/v4/content/Loader.ForceLoadContentObserver)
  - [LocalBroadcastManager](https://developer.android.com/reference/android/support/v4/content/LocalBroadcastManager)
  - [MimeTypeFilter](https://developer.android.com/reference/android/support/v4/content/MimeTypeFilter)
  - [PermissionChecker](https://developer.android.com/reference/android/support/v4/content/PermissionChecker)
  - [SharedPreferencesCompat](https://developer.android.com/reference/android/support/v4/content/SharedPreferencesCompat)
  - [SharedPreferencesCompat.EditorCompat](https://developer.android.com/reference/android/support/v4/content/SharedPreferencesCompat.EditorCompat)
  - [WakefulBroadcastReceiver](https://developer.android.com/reference/android/support/v4/content/WakefulBroadcastReceiver)