a base android <activity>

1.Activity life cycle
oncreater when creating activity
when ondestroy destroyed activity
onStart visible when
onStop not visible when
the time onResume has focus
when onPause no focus
onRestart restart

 2. switch the screen anyway:

android:screenOrientation="landscape" 横屏
android:screenOrientation="portrait" 竖屏
android: configChanges = "orientation | keyboardHidden | screenSize" to prevent automatic screen rotation
 
3. The task stack
1. Open the Activity called into the stack, the stack close activity plus
2. activity of our operation is always the top of the stack activity
3. task stack used to maintain the operation of the user experience
4. The application is considered out of the stack empty of
5. generally a stack of a task corresponding to the application
 
 android:launchMode="singleInstance"
Create a separate activity to a separate task stack, the stack is only one task this activity, activity and task stack can be reused.

 android:launchMode="singleTask"
Detection task stack acitvity, if it already exists, direct reuse.

 android:launchMode="standard"  
 默认标准模式: activity打开一次就会创建一个activity实例

 android:launchMode="singleTop"
任务栈会检查栈顶的acitvity,如果栈顶的ativity 就是当前的activity,则复用栈顶的activity
 
 

Guess you like

Origin www.cnblogs.com/jtzp007/p/11129143.html