When the action starts, the onCreate() method is onCreate() . In the onCreate() method, you execute the basic startup logic, which should happen only once for the entire life cycle.
After onCreate() is executed, the onCreate() method is onStart() . This method makes the activity visible when the application prepares an action to enter the foreground and becomes interactive.
After onStart() is executed, the onStart() method is onResume() . This method is called only when the application is in the foreground , because this is the state in which the application interacts with the user. The application remains in a resumed (or running) state until something succeeds in diverting attention from the application.
If another action comes to the forefront , the onPause() method is onPause() . The application is paused if it is still visible . This method only pauses operation operations. It does not destroy. The action remains in a paused state until the activity resumes or becomes completely invisible to the user. 4a. If the user returns to activity, the onResume() method is called again. 4b. An application process can be killed from a paused state if higher priority applications need memory. If the user must return to the application after it is destroyed, the onCreate() method will be called again
If the action is no longer visible to the user, the onStop() method is onStop() . When the action is stopped, the activity object is stored in memory and saves all state and information, but is not tied to the window manager. 5a. if the user returns to activity, the onRestart() method is onRestart() , followed by the onStart() method. 5 B. an application process can be killed from a stop state if higher priority applications need memory. If the user must return to the application after it is destroyed, the onCreate() method will be called again.
If activity is terminated or killed by the system, the onDestroy() method is onDestroy() . The application does not initially shut down. The system either calls this method because the action ends because someone calls finish() , or because the system temporarily destroys the process containing the operation in order to save space. The system can also call this method when the orientation changes, and then immediately call onCreate() to recreate the process (and the components that it contains) in the new orientation. The onDestroy() method frees up all resources that have not yet been released by earlier methods, such as onStop() .
an entire lifetime of activity occurs between the first call to onCreate() through one final call to onDestroy() .
the visible lifetime of the activity occurs between the onStart() call before the onStop() call.
onResume() between an onResume() call before an onPause() call.
The only method we need to implement is onCreate() . Others are called automatically. But we can implement them ourselves to tell the application what to do during these processes.
https://developer.android.com/guide/components/activities/activity-lifecycle.html#asem
onAttachedToWindow is called when the view is onAttachedToWindow to the window. At this moment he has a Surface and drawing will begin.
https://developer.android.com/reference/android/view/View.html#onAttachedToWindow ()
Kelli davis
source share