一,android 四大组件
Activity、Service、BroadcastReceiver 、ContentProvider
二,Activity生命周期
三,横竖屏切换时的生命周期
1、新建一个Activity,并把各个生命周期打印出来
2、运行Activity,得到如下信息
10-23 02:35:: INFO/chenys(4385): onCreate-->
10-23 02:35:: INFO/chenys(4385): onStart-->
10-23 02:35:: INFO/chenys(4385): onResume-->
3、按crtl+f12切换成横屏时
10-23 02:36:: INFO/chenys(4385): onSaveInstanceState-->
10-23 02:36:: INFO/chenys(4385): onPause-->
10-23 02:36:: INFO/chenys(4385): onStop-->
10-23 02:36:: INFO/chenys(4385): onDestroy-->
10-23 02:36:: INFO/chenys(4385): onCreate-->
10-23 02:36:: INFO/chenys(4385): onStart-->
10-23 02:36:: INFO/chenys(4385): onRestoreInstanceState-->
10-23 02:36:: INFO/chenys(4385): onResume-->
4、再按crtl+f12切换成竖屏时,发现打印了两次相同的log
10-23 02:38:: INFO/chenys(4385): onSaveInstanceState-->
10-23 02:38:: INFO/chenys(4385): onPause-->
10-23 02:38:: INFO/chenys(4385): onStop-->
10-23 02:38:: INFO/chenys(4385): onDestroy-->
10-23 02:38:: INFO/chenys(4385): onCreate-->
10-23 02:38:: INFO/chenys(4385): onStart-->
10-23 02:38:: INFO/chenys(4385): onRestoreInstanceState-->
10-23 02:38:: INFO/chenys(4385): onResume-->
10-23 02:38:: INFO/chenys(4385): onSaveInstanceState-->
10-23 02:38:: INFO/chenys(4385): onPause-->
10-23 02:38:: INFO/chenys(4385): onSt
android基础知识点 来自淘豆网m.daumloan.com转载请标明出处.