Code example for Fragment

Methods: onCreate, setRetainInstance

         * Fragment initialization.  We way we want to be retained and 
         * start our thread. 
        public void onCreate(Bundle savedInstanceState) {
            // Tell the framework to try to keep this fragment around 
            // during a configuration change. 
            // Start up the worker thread. 
         * This is called when the Fragment's Activity is ready to go, after 
         * its content view has been installed; it is called both after 
         * the initial fragment creation and after the fragment is re-attached 
         * to a new activity.