LocalActivityManager
open classLocalActivityManager
kotlin.Any | |
↳ | android.app.LocalActivityManager |
Helper class for managing multiple running embedded activities in the same process. This class is not normally used directly, but rather created for you as part of the android.app.ActivityGroup
implementation.
Summary
Public constructors | |
---|---|
LocalActivityManager(parent: Activity!, singleMode: Boolean) Create a new LocalActivityManager for holding activities running within the given parent. |
Public methods | |
---|---|
open Window! |
destroyActivity(id: String!, finish: Boolean) Destroy the activity associated with a particular id. |
open Unit |
dispatchCreate(state: Bundle!) Restore a state that was previously returned by |
open Unit |
dispatchDestroy(finishing: Boolean) Called by the container activity in its |
open Unit |
dispatchPause(finishing: Boolean) Called by the container activity in its |
open Unit |
Called by the container activity in its |
open Unit |
Called by the container activity in its |
open Activity! |
getActivity(id: String!) Return the Activity object associated with a string ID. |
open Activity! |
Retrieve the Activity that is currently running. |
open String! |
Retrieve the ID of the activity that is currently running. |
open Unit |
Remove all activities from this LocalActivityManager, performing an |
open Bundle! |
Retrieve the state of all activities known by the group. |
open Window! |
startActivity(id: String!, intent: Intent!) Start a new activity running in the group. |
Public constructors
LocalActivityManager
LocalActivityManager(
parent: Activity!,
singleMode: Boolean)
Create a new LocalActivityManager for holding activities running within the given parent.
Parameters | |
---|---|
parent |
Activity!: the host of the embedded activities |
singleMode |
Boolean: True if the LocalActivityManger should keep a maximum of one activity resumed |
Public methods
destroyActivity
open fundestroyActivity(
id: String!,
finish: Boolean
): Window!
Deprecated: Deprecated in Java.
Destroy the activity associated with a particular id. This activity will go through the normal lifecycle events and fine onDestroy(), and then the id removed from the group.
Parameters | |
---|---|
id |
String!: Unique identifier of the activity to be destroyed |
finish |
Boolean: If true, this activity will be finished, so its id and all state are removed from the group. |
Return | |
---|---|
Window! |
Returns the window that was used to display the activity, or null if there was none. |
dispatchCreate
open fundispatchCreate(state: Bundle!): Unit
Deprecated: Deprecated in Java.
Restore a state that was previously returned by saveInstanceState
. This adds to the activity group information about all activity IDs that had previously been saved, even if they have not been started yet, so if the user later navigates to them the correct state will be restored.
Note: This does not change the current running activity, or start whatever activity was previously running when the state was saved. That is up to the client to do, in whatever way it thinks is best.
Parameters | |
---|---|
state |
Bundle!: a previously saved state; does nothing if this is null |
See Also
dispatchDestroy
open fundispatchDestroy(finishing: Boolean): Unit
Deprecated: Deprecated in Java.
Called by the container activity in its Activity.onDestroy
so that LocalActivityManager can perform the corresponding action on the activities it holds.
See Also
dispatchPause
open fundispatchPause(finishing: Boolean): Unit
Deprecated: Deprecated in Java.
Called by the container activity in its Activity.onPause
so that LocalActivityManager can perform the corresponding action on the activities it holds.
Parameters | |
---|---|
finishing |
Boolean: set to true if the parent activity has been finished; this can be determined by calling Activity.isFinishing() |
dispatchResume
open fundispatchResume(): Unit
Deprecated: Deprecated in Java.
Called by the container activity in its Activity.onResume
so that LocalActivityManager can perform the corresponding action on the activities it holds.
See Also
dispatchStop
open fundispatchStop(): Unit
Deprecated: Deprecated in Java.
Called by the container activity in its Activity.onStop
so that LocalActivityManager can perform the corresponding action on the activities it holds.
See Also
getActivity
open fungetActivity(id: String!): Activity!
Deprecated: Deprecated in Java.
Return the Activity object associated with a string ID.
Return | |
---|---|
Activity! |
the associated Activity object, or null if the id is unknown or its activity is not currently instantiated |
See Also
getCurrentActivity
open fungetCurrentActivity(): Activity!
Deprecated: Deprecated in Java.
Retrieve the Activity that is currently running.
Return | |
---|---|
Activity! |
the currently running (resumed) Activity, or null if there is not one |
See Also
getCurrentId
open fungetCurrentId(): String!
Deprecated: Deprecated in Java.
Retrieve the ID of the activity that is currently running.
Return | |
---|---|
String! |
the ID of the currently running (resumed) Activity, or null if there is not one |
See Also
removeAllActivities
open funremoveAllActivities(): Unit
Deprecated: Deprecated in Java.
Remove all activities from this LocalActivityManager, performing an Activity.onDestroy
on any that are currently instantiated.
saveInstanceState
open funsaveInstanceState(): Bundle!
Deprecated: Deprecated in Java.
Retrieve the state of all activities known by the group. For activities that have previously run and are now stopped or finished, the last saved state is used. For the current running activity, its android.app.Activity#onSaveInstanceState is called to retrieve its current state.
Return | |
---|---|
Bundle! |
a Bundle holding the newly created state of all known activities |
See Also
startActivity
open funstartActivity(
id: String!,
intent: Intent!
): Window!
Deprecated: Deprecated in Java.
Start a new activity running in the group. Every activity you start must have a unique string ID associated with it -- this is used to keep track of the activity, so that if you later call startActivity() again on it the same activity object will be retained.
When there had previously been an activity started under this id, it may either be destroyed and a new one started, or the current one re-used, based on these conditions, in order:
- If the Intent maps to a different activity component than is currently running, the current activity is finished and a new one started.
- If the current activity uses a non-multiple launch mode (such as singleTop), or the Intent has the
Intent.FLAG_ACTIVITY_SINGLE_TOP
flag set, then the current activity will remain running and itsActivity.onNewIntent()
method called. - If the new Intent is the same (excluding extras) as the previous one, and the new Intent does not have the
Intent.FLAG_ACTIVITY_CLEAR_TOP
set, then the current activity will remain running as-is. - Otherwise, the current activity will be finished and a new one started.
If the given Intent can not be resolved to an available Activity, this method throws android.content.ActivityNotFoundException
.
Warning: There is an issue where, if the Intent does not include an explicit component, we can restore the state for a different activity class than was previously running when the state was saved (if the set of available activities changes between those points).
Parameters | |
---|---|
id |
String!: Unique identifier of the activity to be started |
intent |
Intent!: The Intent describing the activity to be started |
Return | |
---|---|
Window! |
Returns the window of the activity. The caller needs to take care of adding this window to a view hierarchy, and likewise dealing with removing the old window if the activity has changed. |
Exceptions | |
---|---|
android.content.ActivityNotFoundException |