Methods Summary |
---|
private static ActivityCompat21.SharedElementCallback21 | createCallback(SharedElementCallback callback)
ActivityCompat21.SharedElementCallback21 newCallback = null;
if (callback != null) {
newCallback = new ActivityCompat.SharedElementCallback21Impl(callback);
}
return newCallback;
|
public static void | finishAffinity(android.app.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 {@link Activity#finish()} will be called instead.
if (Build.VERSION.SDK_INT >= 16) {
ActivityCompatJB.finishAffinity(activity);
} else {
activity.finish();
}
|
public static void | finishAfterTransition(android.app.Activity activity)Reverses the Activity Scene entry Transition and triggers the calling Activity
to reverse its exit Transition. When the exit Transition completes,
{@link Activity#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.
if (Build.VERSION.SDK_INT >= 21) {
ActivityCompat21.finishAfterTransition(activity);
} else {
activity.finish();
}
|
public static boolean | invalidateOptionsMenu(android.app.Activity activity)Invalidate the activity's options menu, if able.
Before API level 11 (Android 3.0/Honeycomb) the lifecycle of the
options menu was controlled primarily by the user's operation of
the hardware menu key. When the user presses down on the menu key
for the first time the menu was created and prepared by calls
to {@link Activity#onCreateOptionsMenu(android.view.Menu)} and
{@link Activity#onPrepareOptionsMenu(android.view.Menu)} respectively.
Subsequent presses of the menu key kept the existing instance of the
Menu itself and called {@link Activity#onPrepareOptionsMenu(android.view.Menu)}
to give the activity an opportunity to contextually alter the menu
before the menu panel was shown.
In Android 3.0+ the Action Bar forces the options menu to be built early
so that items chosen to show as actions may be displayed when the activity
first becomes visible. The Activity method invalidateOptionsMenu forces
the entire menu to be destroyed and recreated from
{@link Activity#onCreateOptionsMenu(android.view.Menu)}, offering a similar
though heavier-weight opportunity to change the menu's contents. Normally
this functionality is used to support a changing configuration of Fragments.
Applications may use this support helper to signal a significant change in
activity state that should cause the options menu to be rebuilt. If the app
is running on an older platform version that does not support menu invalidation
the app will still receive {@link Activity#onPrepareOptionsMenu(android.view.Menu)}
the next time the user presses the menu key and this method will return false.
If this method returns true the options menu was successfully invalidated.
if (Build.VERSION.SDK_INT >= 11) {
ActivityCompatHoneycomb.invalidateOptionsMenu(activity);
return true;
}
return false;
|
public static void | postponeEnterTransition(android.app.Activity activity)
if (Build.VERSION.SDK_INT >= 21) {
ActivityCompat21.postponeEnterTransition(activity);
}
|
public static void | setEnterSharedElementCallback(android.app.Activity activity, SharedElementCallback callback)When {@link android.app.ActivityOptions#makeSceneTransitionAnimation(Activity,
android.view.View, String)} was used to start an Activity, callback
will be called to handle shared elements on the launched Activity. This requires
{@link android.view.Window#FEATURE_CONTENT_TRANSITIONS}.
if (Build.VERSION.SDK_INT >= 21) {
ActivityCompat21.setEnterSharedElementCallback(activity, createCallback(callback));
}
|
public static void | setExitSharedElementCallback(android.app.Activity activity, SharedElementCallback callback)When {@link android.app.ActivityOptions#makeSceneTransitionAnimation(Activity,
android.view.View, String)} was used to start an Activity, callback
will be called to handle shared elements on the launching Activity. Most
calls will only come when returning from the started Activity.
This requires {@link android.view.Window#FEATURE_CONTENT_TRANSITIONS}.
if (Build.VERSION.SDK_INT >= 21) {
ActivityCompat21.setExitSharedElementCallback(activity, createCallback(callback));
}
|
public static void | startActivity(android.app.Activity activity, android.content.Intent intent, android.os.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 {@link 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.
if (Build.VERSION.SDK_INT >= 16) {
ActivityCompatJB.startActivity(activity, intent, options);
} else {
activity.startActivity(intent);
}
|
public static void | startActivityForResult(android.app.Activity activity, android.content.Intent intent, int requestCode, android.os.Bundle options)Start new activity with options, if able, for which you would like a
result when it finished.
In Android 4.1+ additional options were introduced to allow for more
control on activity launch animations. Applications can use this method
along with {@link 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.
if (Build.VERSION.SDK_INT >= 16) {
ActivityCompatJB.startActivityForResult(activity, intent, requestCode, options);
} else {
activity.startActivityForResult(intent, requestCode);
}
|
public static void | startPostponedEnterTransition(android.app.Activity activity)
if (Build.VERSION.SDK_INT >= 21) {
ActivityCompat21.startPostponedEnterTransition(activity);
}
|