Back to project page FragmentTutorial.
The source code is released under:
Apache License
If you think the Android project FragmentTutorial listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package com.yanlu.android.fragment.frg; /*from w w w. j ava 2 s. co m*/ import android.app.Activity; import android.os.Bundle; import android.support.v4.app.Fragment; import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import com.yanlu.android.fragment.R; /** * User: captain_miao * Date: 14-5-7 * Time: ????9:23 */ public class FragmentByXml extends Fragment { private static final String TAG = "FragmentByXml"; public FragmentByXml() { } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Inflate the layout for this fragment setRetainInstance(true);//Static fragment are always recreated return inflater.inflate(R.layout.fragment_setting, container, false); } @Override public void onResume() { super.onResume(); Log.d(TAG, "onResume( )"); } @Override public void onAttach(Activity activity) { super.onAttach(activity); Log.d(TAG, "onAttach(activity)"); } @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Log.d(TAG, "onCreate(savedInstanceState)"); } @Override public void onDetach() { super.onDetach(); Log.d(TAG, "onDetach( )"); } @Override public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); Log.d(TAG, "onActivityCreated(savedInstanceState)"); } @Override public void onStart() { super.onStart(); Log.d(TAG, "onStart( )"); } @Override public void onPause() { super.onPause(); Log.d(TAG, "onPause( )"); } @Override public void onStop() { super.onStop(); Log.d(TAG, "onStop( )"); } @Override public void onDestroyView() { super.onDestroyView(); Log.d(TAG, "onDestroyView( )"); } @Override public void onDestroy() { super.onDestroy(); Log.d(TAG, "onDestroy( )"); } }