一个 ViewPager中包含3个Fragment,Fragment随Activity的生命周期如下。
三个Fragment从左到右依次是frist,second,thrid
打开Activity
03-24 13:15:51.622: V/first(3844): +onAttach+
03-24 13:15:51.622: V/first(3844): +onCreate+
03-24 13:15:51.622: V/first(3844): +onCreateView+
03-24 13:15:51.652: V/first(3844): +onActivityCreated+
03-24 13:15:51.652: V/first(3844): +onStart+
03-24 13:15:51.652: V/first(3844): +onResume+
03-24 13:15:51.652: V/second(3844): +onAttach+
03-24 13:15:51.652: V/second(3844): +onCreate+
03-24 13:15:51.652: V/second(3844): +onCreateView+
03-24 13:15:51.652: V/second(3844): +onActivityCreated+
03-24 13:15:51.652: V/second(3844): +onStart+
03-24 13:15:51.652: V/second(3844): +onResume+
切换到第二个标签页
03-24 13:16:12.852: V/third(3844): +onAttach+
03-24 13:16:12.852: V/third(3844): +onCreate+
03-24 13:16:12.852: V/third(3844): +onCreateView+
03-24 13:16:12.862: V/third(3844): +onActivityCreated+
03-24 13:16:12.862: V/third(3844): +onStart+
03-24 13:16:12.862: V/third(3844): +onResume+
切换到第三个标签页
03-24 13:16:18.212: V/first(3844): +onPause+
03-24 13:16:18.212: V/first(3844): +onStop+
03-24 13:16:18.212: V/first(3844): +onDestroyView+
再切回第二个
03-24 13:16:24.252: V/first(3844): +onCreateView+
03-24 13:16:24.292: D/AbsListView(3844): Get MotionRecognitionManager
03-24 13:16:24.302: V/first(3844): +onActivityCreated+
03-24 13:16:24.302: V/first(3844): +onStart+
03-24 13:16:24.312: V/first(3844): +onResume+
再切回第一个
03-24 13:16:43.952: V/third(3844): +onPause+
03-24 13:16:43.952: V/third(3844): +onStop+
03-24 13:16:43.952: V/third(3844): +onDestroyView+
再第二个标签页点HOME
03-24 13:17:55.032: V/first(3844): +onPause+
03-24 13:17:55.032: V/second(3844): +onPause+
03-24 13:17:55.032: V/third(3844): +onPause+
03-24 13:17:55.542: V/first(3844): +onStop+
03-24 13:17:55.542: V/second(3844): +onStop+
03-24 13:17:55.542: V/third(3844): +onStop+
再进入程序
03-24 13:17:58.232: V/first(3844): +onStart+
03-24 13:17:58.232: V/second(3844): +onStart+
03-24 13:17:58.232: V/third(3844): +onStart+
03-24 13:17:58.232: V/first(3844): +onResume+
03-24 13:17:58.232: V/second(3844): +onResume+
03-24 13:17:58.232: V/third(3844): +onResume+
退出程序
03-24 13:18:04.832: V/first(3844): +onPause+
03-24 13:18:04.832: V/second(3844): +onPause+
03-24 13:18:04.832: V/third(3844): +onPause+
03-24 13:18:05.232: V/first(3844): +onStop+
03-24 13:18:05.232: V/second(3844): +onStop+
03-24 13:18:05.232: V/third(3844): +onStop+
03-24 13:18:05.232: V/first(3844): +onDestroyView+
03-24 13:18:05.232: V/first(3844): +onDestroy+
03-24 13:18:05.232: V/first(3844): +onDetach+
03-24 13:18:05.232: V/second(3844): +onDestroyView+
03-24 13:18:05.232: V/second(3844): +onDestroy+
03-24 13:18:05.232: V/second(3844): +onDetach+
03-24 13:18:05.232: V/third(3844): +onDestroyView+
03-24 13:18:05.232: V/third(3844): +onDestroy+
03-24 13:18:05.232: V/third(3844): +onDetach+