class overview
Helper class for managing multiple running embedded activities in the same process. This was not a normally used directly, but rather created for your as part of the ActivityGroup implementation.
First of all, it means that this class cannot be used alone, only in Activitygroup. His role is to manage the interface of multiple running embedded activity ...
A description of the member method:
Actually see the SDK also can know ...
The main thing is the dispatch method, which allows an operation to be used for the activity in this activitygroup.
| Window |
destroyactivity (String ID, boolean finish) destroys the activity of the ID .... and return the view of the activity you deleted ... Destroy the activity associated with a particular ID. |
| void |
dispatchcreate (Bundle State) Restore a state is previously returned by saveInstanceState() . |
| void |
Dispatchdestroy (Boolean finishing) Called by the container activity in it so, onDestroy() Localactivitymanager can perform the corresponding action on the Act Ivities it holds. |
| void |
Dispatchpause (Boolean finishing) Called by the container activity in it so, onPause() Localactivitymanager can perform the corresponding action on the Act Ivities it holds. |
| void |
Dispatchresume () Called by the container activity in it so, onResume() Localactivitymanager can perform the corresponding action on the Act Ivities it holds. |
| void |
dispatchstop () Called by the container activity in it so, onStop() Localactivitymanager can perform the corresponding action on the Act Ivities it holds. |
| Activity |
getactivity (String ID) Return the Activity object associated with a string ID. |
| Activity |
getcurrentactivity () Retrieve The Activity is currently running. |
| String |
Getcurrentid () Retrieve the ID of the activity is currently running. |
| void |
removeallactivities () Remove all activities from this localactivitymanager, performing a on any that is onDestroy() currently instantiated. |
| Bundle |
saveinstancestate () Retrieve the state of all activities known by the group. |
| Window |
startactivity (String ID, Intent Intent) Start a new activity running in the group. |
Here is a description of startactivity (String ID, Intent Intent) This method:
Start a new activity running in the group. Every activity you start must has 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 would be retained.
When there had previously been an activity started under this ID, it could 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 are 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 have the
FLAG_ACTIVITY_SINGLE_TOP flag set, then th E Current activity would remain running and its Activity.onNewIntent() method called.
- If The new Intent is the same (excluding extras) as the previous one, and the new Intent does not having
FLAG_ACTIVITY_CLEAR_TOP the set, then The current activity would remain running as-is.
- Otherwise, the current activity would be finished and a new one started.
If the given Intent can not is resolved to a 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 dif Ferent activity class than is previously running when the state is saved (if the set of available activities changes bet Ween those points).
Parameters
| Id |
Unique identifier of the activity to be started |
| Intent |
The Intent describing the activity to be started |
return value
- 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.
A simple translation is:
Create new and run an activity in Activitygroup, the main explanation is inside the string ID, saying try not to use the same in the new time
ID, because this looks like this will cause if you use the StartActivity again (), then you will continue to keep ...
When the activity needs to be destroyed:
If you have the following situation, you can not destroy it. All others need to be destroyed ...
1. There is already an old intent, and the new intent does not use FLAG_ACTIVITY_CLEAR_TOP this parameter
2. The current activity is using uses a non-multiple launch mode.
3.intent also have not from the interface components ...
Android Localactivitymanager Instructions