Android Learning _7 / 24

First, the            life cycle activities

1.         active

Run: Located in the return stack top of the stack

Pause: not top of the stack, but still visible

Stop: top of the stack is not completely invisible

Destruction: Remove from the stack

2.         survival activities

1)          7 Zhong callback method with 3 Zhong survival

onCreate () ~ onDestory ()           intact survival

onStart () ~ onStop ()                     visible survival

onResume () ~ onPause ()            Front survival

onRestart()

2)          designated theme

android: theme attribute dialog style theme of the event (android: theme = "@ style / Theme.Appcompat.Dialog") activity before will not be completely blocked.

3)          After saving the data recovery activities

onSaveInstance()

3.         Activities startup mode

1)         standard

Each time you start a new activity will push

2)         singleTop

Start-up activities have been found in the top of the stack, the direct use, no longer create a new instance of activity

3)         singleTask

Check for the presence of this activity will be more activities throughout the stack

4)         singleInstance

Enabling a new stack management activities to achieve multiple applications to share this event example

4.         Best Practices

1)          Use getClass.getSimpleName () Print this event

2)          a special collection to use to manage all activities to achieve out anytime, anywhere

3)          Add the boot method for each activity

 


Guess you like

Origin www.cnblogs.com/pomodoro/p/11240439.html