package com.example.fragmentdynamic;


import android.app.Activity;
import android.app.Fragment;
import android.os.Bundle;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

public class DetailsFragment extends Fragment {
	
	// Called when the Fragment is attached to its parent Activity.
	@Override
    public void onAttach(Activity activity) {
		super.onAttach(activity);
	    // TODO: Get a reference to the parent Activity.
		Log.d("Fragment 1", "onAttach");
	}
    
	// Called to do the initial creation of the Fragment.
	@Override
    public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		//// TODO: Initialize the Fragment.
		Log.d("Fragment 1", "onCreate"); 
	}

	 // Called once the Fragment has been created in order for it to
	 // create its user interface.
    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
    	
        // TODO:Create, or inflate the Fragment's UI, and return it. 
        // If this Fragment has no UI then return null.
    	Log.d("Fragment 1", "onCreateView");
        return inflater.inflate(R.layout.details_fragment, container, false);
    }
    
    // Called once the parent Activity and the Fragment's UI have 
    // been created.
	@Override
    public void onActivityCreated(Bundle savedInstanceState) {
		super.onActivityCreated(savedInstanceState);

	    // TODO: Complete the Fragment initialization Ð particularly anything
	    // that requires the parent Activity to be initialized or the 
	    // Fragment's view to be fully inflated.
		Log.d("Fragment 1", "onActivityCreated");
	}

	// Called at the start of the visible lifetime.
	@Override
    public void onStart() {
		super.onStart();

		 // TODO:Apply any required UI change now that the Fragment is visible.
		Log.d("Fragment 1", "onStart");
	}

	 // Called at the start of the active lifetime.
	@Override
    public void onResume() {
		super.onResume();
	    // TODO:Resume any paused UI updates, threads, or processes required
	    // by the Fragment but suspended when it became inactive.
		Log.d("Fragment 1", "onResume");
	}

	 // Called at the end of the active lifetime.
	@Override
    public void onPause() {
		super.onPause();
		// TODO:Suspend UI updates, threads, or CPU intensive processes
	    // that don't need to be updated when the Activity isn't
	    // the active foreground activity.
	    // Persist all edits or state changes
	    // as after this call the process is likely to be killed.
		Log.d("Fragment 1", "onPause");
	}
	
	  // Called to save UI state changes at the
	  // end of the active lifecycle.
	  @Override
	  public void onSaveInstanceState(Bundle savedInstanceState) {
	    // Save UI state changes to the savedInstanceState.
	    // This bundle will be passed to onCreate, onCreateView, and
	    // onCreateView if the parent Activity is killed and restarted.
		 Log.d("Fragment 1", "onSaveInstanceState");
	    super.onSaveInstanceState(savedInstanceState);
	  }
	    
	
	// Called at the end of the visible lifetime.
	@Override
    public void onStop() {
		super.onStop();
	    // TODO:Suspend remaining UI updates, threads, or processing
	    // that aren't required when the Fragment isn't visible.
		Log.d("Fragment 1", "onStop");
	}
	
	  // Called when the Fragment's View has been detached.
	@Override
    public void onDestroyView() {
		super.onDestroyView();
	    // TODO:Clean up resources related to the View.
		Log.d("Fragment 1", "onDestroyView");
	}

	// Called at the end of the full lifetime.
	@Override
    public void onDestroy() {
		super.onDestroy();
		// TODO:Clean up any resources including ending threads,
	    // closing database connections etc.
		Log.d("Fragment 1", "onDestroy");
	}
	
	// Called when the Fragment has been detached from its parent Activity.
	@Override
    public void onDetach() {
		super.onDetach();
		Log.d("Fragment 1", "onDetach");
	}
}