Fragment
and FragmentManager
APIs
instead; these are also
available on older platforms through the Android compatibility package.@Deprecated public class LocalActivityManager extends Object
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 ActivityGroup
implementation.
ActivityGroup
Constructor and Description |
---|
LocalActivityManager(Activity parent,
boolean singleMode)
Deprecated.
Create a new LocalActivityManager for holding activities running within
the given parent.
|
Modifier and Type | Method and Description |
---|---|
Window |
destroyActivity(String id,
boolean finish)
Deprecated.
Destroy the activity associated with a particular id.
|
void |
dispatchCreate(Bundle state)
Deprecated.
Restore a state that was previously returned by
saveInstanceState() . |
void |
dispatchDestroy(boolean finishing)
Deprecated.
Called by the container activity in its
Activity.onDestroy() so
that LocalActivityManager can perform the corresponding action on the
activities it holds. |
void |
dispatchPause(boolean finishing)
Deprecated.
Called by the container activity in its
Activity.onPause() so
that LocalActivityManager can perform the corresponding action on the
activities it holds. |
void |
dispatchResume()
Deprecated.
Called by the container activity in its
Activity.onResume() so
that LocalActivityManager can perform the corresponding action on the
activities it holds. |
HashMap<String,Object> |
dispatchRetainNonConfigurationInstance()
Deprecated.
Call onRetainNonConfigurationInstance on each child activity and store the
results in a HashMap by id.
|
void |
dispatchStop()
Deprecated.
Called by the container activity in its
Activity.onStop() so
that LocalActivityManager can perform the corresponding action on the
activities it holds. |
Activity |
getActivity(String id)
Deprecated.
Return the Activity object associated with a string ID.
|
Activity |
getCurrentActivity()
Deprecated.
Retrieve the Activity that is currently running.
|
String |
getCurrentId()
Deprecated.
Retrieve the ID of the activity that is currently running.
|
void |
removeAllActivities()
Deprecated.
Remove all activities from this LocalActivityManager, performing an
Activity.onDestroy() on any that are currently instantiated. |
Bundle |
saveInstanceState()
Deprecated.
Retrieve the state of all activities known by the group.
|
Window |
startActivity(String id,
Intent intent)
Deprecated.
Start a new activity running in the group.
|
public LocalActivityManager(Activity parent, boolean singleMode)
parent
- the host of the embedded activitiessingleMode
- True if the LocalActivityManger should keep a maximum
of one activity resumedpublic Window startActivity(String id, Intent intent)
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:
Intent.FLAG_ACTIVITY_SINGLE_TOP
flag set, then the current
activity will remain running and its
Activity.onNewIntent()
method
called.
Intent.FLAG_ACTIVITY_CLEAR_TOP
set, then the current activity
will remain running as-is.
If the given Intent can not be resolved to an available Activity,
this method throws 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).
id
- Unique identifier of the activity to be startedintent
- The Intent describing the activity to be startedActivityNotFoundException
public Window destroyActivity(String id, boolean finish)
id
- Unique identifier of the activity to be destroyedfinish
- If true, this activity will be finished, so its id and
all state are removed from the group.public Activity getCurrentActivity()
startActivity(java.lang.String, android.content.Intent)
,
getCurrentId()
public String getCurrentId()
startActivity(java.lang.String, android.content.Intent)
,
getCurrentActivity()
public Activity getActivity(String id)
startActivity(java.lang.String, android.content.Intent)
public void dispatchCreate(Bundle state)
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.
state
- a previously saved state; does nothing if this is nullsaveInstanceState()
public Bundle saveInstanceState()
Activity.onSaveInstanceState(android.os.Bundle)
is called to retrieve its current state.dispatchCreate(android.os.Bundle)
public void dispatchResume()
Activity.onResume()
so
that LocalActivityManager can perform the corresponding action on the
activities it holds.Activity.onResume()
public void dispatchPause(boolean finishing)
Activity.onPause()
so
that LocalActivityManager can perform the corresponding action on the
activities it holds.finishing
- set to true if the parent activity has been finished;
this can be determined by calling
Activity.isFinishing()Activity.onPause()
,
Activity.isFinishing()
public void dispatchStop()
Activity.onStop()
so
that LocalActivityManager can perform the corresponding action on the
activities it holds.Activity.onStop()
public HashMap<String,Object> dispatchRetainNonConfigurationInstance()
public void removeAllActivities()
Activity.onDestroy()
on any that are currently instantiated.public void dispatchDestroy(boolean finishing)
Activity.onDestroy()
so
that LocalActivityManager can perform the corresponding action on the
activities it holds.Activity.onDestroy()