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 ActivityGroup implementation.
Summary
Public Constructors
Public Methods
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait
Details
Public Constructors
public
LocalActivityManager(Activity parent, boolean singleMode)
Create a new LocalActivityManager for holding activities running within
the given
parent.
Parameters
| parent
| the host of the embedded activities |
| singleMode
| True if the LocalActivityManger should keep a maximum
of one activity resumed
|
Public Methods
public
void
dispatchDestroy()
Called by the container activity in its
onDestroy() so
that LocalActivityManager can perform the corresponding action on the
activities it holds.
public
void
dispatchPause(boolean finishing)
Called by the container activity in its
onPause() so
that LocalActivityManager can perform the corresponding action on the
activities it holds.
Parameters
| finishing
| set to true if the parent activity has been finished;
this can be determined by calling
Activity.isFinishing() |
public
void
dispatchResume()
Called by the container activity in its
onResume() so
that LocalActivityManager can perform the corresponding action on the
activities it holds.
public
void
dispatchStop()
Called by the container activity in its
onStop() so
that LocalActivityManager can perform the corresponding action on the
activities it holds.
public
Bundle
freeze()
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
onFreeze(Bundle) is called to retrieve its current state.
Returns
- a Bundle holding the newly created state of all known activities
Return the Activity object associated with a string ID.
Returns
- the associated Activity object, or null if the id is unknown or
its activity is not currently instantiated
public
Activity
getCurrentActivity()
Retrieve the Activity that is currently running.
Returns
- the currently running (resumed) Activity, or null if there is
not one
public
String
getCurrentId()
Retrieve the ID of the activity that is currently running.
Returns
- the ID of the currently running (resumed) Activity, or null if
there is not one
public
void
removeAllActivities()
Remove all activities from this LocalActivityManager, performing on
onDestroy() on any that are currently instantiated.
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 re-started.
Note: You must make sure that you always use the same Intent every
time for a particular string ID.
If the given Intent can not be resolved to an available Activity,
this method throws ActivityNotFoundException.
XXX TODO(hackbod) 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
| Unique identifier of the activity to be started |
| intent
| The Intent describing the activity to be started |
Returns
- Returns the window of the activity.
public
void
thaw(Bundle state)
Restore a state that was previously returned by
freeze(). 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
| a previously saved state; does nothing if this is null |