To start an activity, we need to register each and every activity in the manifest file
android:name=".MainActivity">
</activity>
<activity android:label="@string/app_name"android:name=".MainActivity">
</activity>
Activity Life Cycle
The Activity Manager manages the life cycle of activities. Following are the different states of activity life cycle.
- Starting State
- Running State
The Activity Manager allocates the memory and resources for particular activity.
In this state, only one activity(which is in focus) can be displayed on screen.
- Paused State
An Activity is in paused state when it’s not in focus or can be visible on screen.
The Activity Manager calls onPause() method to put an activity into this state.
For example, Any toast notification or dialog box come up in front of any activity.
- Stopped State
An Activity is in stopped state when it’s not visible on screen, but memory not released.
The Activity Manager calls onStop() method to put an activity into this state.
- Destroyed State
An activity is destroyed and released from memory.
The Activity Manager calls onDestroy() method to put an activity into this state.
Comments
Post a Comment