belongs to Maven artifact com.android.support:support-compat:28.0.0-alpha1
ActivityCompat
public
class
ActivityCompat
extends ContextCompat
java.lang.Object | ||
↳ | android.support.v4.content.ContextCompat | |
↳ | android.support.v4.app.ActivityCompat |
![]() |
Helper for accessing features in Activity
.
Summary
Nested classes | |
---|---|
interface |
ActivityCompat.OnRequestPermissionsResultCallback
This interface is the contract for receiving the results for permission requests. |
interface |
ActivityCompat.PermissionCompatDelegate
Customizable delegate that allows delegating permission compatibility methods to a custom implementation. |
Protected constructors | |
---|---|
ActivityCompat()
This class should not be instantiated, but the constructor must be visible for the class to be extended (as in support-v13). |
Public methods | |
---|---|
static
void
|
finishAffinity(Activity activity)
Finish this activity, and tries to finish all activities immediately below it in the current task that have the same affinity. |
static
void
|
finishAfterTransition(Activity activity)
Reverses the Activity Scene entry Transition and triggers the calling Activity to reverse its exit Transition. |
static
Uri
|
getReferrer(Activity activity)
Return information about who launched this activity. |
static
boolean
|
invalidateOptionsMenu(Activity activity)
This method was deprecated
in API level 27.1.0.
Use |
static
void
|
postponeEnterTransition(Activity activity)
|
static
DragAndDropPermissionsCompat
|
requestDragAndDropPermissions(Activity activity, DragEvent dragEvent)
Create |
static
void
|
requestPermissions(Activity activity, String[] permissions, int requestCode)
Requests permissions to be granted to this application. |
static
<T extends View>
T
|
requireViewById(Activity activity, int id)
Finds a view that was identified by the |
static
void
|
setEnterSharedElementCallback(Activity activity, SharedElementCallback callback)
When |
static
void
|
setExitSharedElementCallback(Activity activity, SharedElementCallback callback)
When |
static
void
|
setPermissionCompatDelegate(ActivityCompat.PermissionCompatDelegate delegate)
Sets the permission delegate for |
static
boolean
|
shouldShowRequestPermissionRationale(Activity activity, String permission)
Gets whether you should show UI with rationale for requesting a permission. |
static
void
|
startActivityForResult(Activity activity, Intent intent, int requestCode, Bundle options)
Start new activity with options, if able, for which you would like a result when it finished. |
static
void
|
startIntentSenderForResult(Activity activity, IntentSender intent, int requestCode, Intent fillInIntent, int flagsMask, int flagsValues, int extraFlags, Bundle options)
Start new IntentSender with options, if able, for which you would like a result when it finished. |
static
void
|
startPostponedEnterTransition(Activity activity)
|
Inherited methods | |
---|---|
![]()
android.support.v4.content.ContextCompat
| |
![]()
java.lang.Object
|
Protected constructors
ActivityCompat
ActivityCompat ()
This class should not be instantiated, but the constructor must be visible for the class to be extended (as in support-v13).
Public methods
finishAffinity
void finishAffinity (Activity activity)
Finish this activity, and tries to finish all activities immediately below it in the current task that have the same affinity.
On Android 4.1+ calling this method will call through to the native version of this
method. For other platforms finish()
will be called instead.
Parameters | |
---|---|
activity |
Activity |
finishAfterTransition
void finishAfterTransition (Activity activity)
Reverses the Activity Scene entry Transition and triggers the calling Activity
to reverse its exit Transition. When the exit Transition completes,
finish()
is called. If no entry Transition was used, finish() is called
immediately and the Activity exit Transition is run.
On Android 4.4 or lower, this method only finishes the Activity with no special exit transition.
Parameters | |
---|---|
activity |
Activity |
getReferrer
Uri getReferrer (Activity activity)
Return information about who launched this activity. If the launching Intent
contains an Intent.EXTRA_REFERRER
,
that will be returned as-is; otherwise, if known, an
android-app:
referrer URI containing the
package name that started the Intent will be returned. This may return null if no
referrer can be identified -- it is neither explicitly specified, nor is it known which
application package was involved.
If called while inside the handling of onNewIntent(Intent)
, this function will
return the referrer that submitted that new intent to the activity. Otherwise, it
always returns the referrer of the original Intent.
Note that this is not a security feature -- you can not trust the referrer information, applications can spoof it.
Parameters | |
---|---|
activity |
Activity |
Returns | |
---|---|
Uri |