When a user enters. When you exit and enter your app again, your app Activity
will switch between the various states of its life cycle.
For example, when your activity starts for the first time. It takes the focus of the user in front of the system today. In this process, the Android system invokes a series of life cycle methods to set up the UI and other components. Suppose the user runs an operation, initiates an activity, or switches to another application. Your activity will move to the background (when activity is no longer visible, but its strength and state remain the same), and the system will invoke some other life cycle methods.
Through these life cycle methods. You can state how your activity behaves when the user leaves and enters your activity again.
For example, if you are building a streaming file for a video player, you may want to pause the screen at the same time to terminate the network request when the user switches to another app. Once the user comes back, you can connect to the network again and consent to the user viewing the video again from the same place.
This course explains the Activity
important life cycle approaches that instances receive and how you can do your activity to meet users ' expectations and not continue to consume them when the activity does not require system resources.
Course
-
Starting an Activity
-
Learn the basics of activity declaration cycles, how users start your app, and how to run major activity creation.
-
Pausing and Resuming an Activity
-
Learn what's going on in your activitypaused (partially obscured) and resumed, and what you should do when these states change.
-
Stopping and restarting an Activity
-
Learn what happens when a user completely leaves your activity and has returned to your activity.
-
Recreating an Activity
-
Learn what happens when your app has been destroyed. And how you can create the status of your activity again when necessary.
Android Learning Route (11) Managing the life cycle of activity