The method [Android] Android in activity in

Android to build a program, the default activity in MainActivity overloading the onCreate () method.

 

 In addition onCreate (), there onStart (), onResume (), onPause (), onStop (), onRestart (), onDestroy () method.

  The system creates activities began in onCreate. Once the onCreate () method completed, that the activity in Create state. onCreate method is called only once during the life cycle of activity.

  Next, the system calls the method onStart activities. When calling onStart method, the activity becomes visible . Once onStart method is complete, the activity is in start state. onStart method can be called multiple times.

  After the system will call onResume method, after onResume method, enter resume active state. In the life cycle of activity, onResume can be called multiple times.

Once inside the Resume state, the basic activities in operation, and in this state, until something happens to change it. For example, since the device you want to sleep and turn off the alarm on or off the screen, or may be due to other activities started.

  Resumed activity will have to leave the state, it will call its onPause method. Once completed onPause method, enters the Paused state activities. In the life cycle of activity, onPause method can be called multiple times.

  After onPause method, if the activity becomes completely invisible, calls onStop method, enter Stoped state.

  If the Paused state, activity has been activated, calls onResume method. If Stoped status, activity returned to the front desk will call onRestart method, and then call onStart method.

  When the event finally stopped, it calls onDestroy method. The method of the life cycle can only be called once.

 

Guess you like

Origin www.cnblogs.com/to-red/p/Android.html