title: fragment is not replaced on click
body: <p>i am developing an app in which i have detail activity which consist a detail fragment ,a detail fragment contain a 4 button and what i want when i clicked on that button i ll move to the new fragment but my fragment is not replacing as i used the fragment Transaction replace method ,pleaase provide me the better approach and  look forward to mine approach as well</p>
  
  <p>this is detail fragment </p>
  
  <pre><code>public class DetailActivityFragment extends Fragment{
  
  TextView textView;
  ImageView imageView;
  TextView details;
  Button button;
  public DetailActivityFragment() {
  }
  
  @Override
  public View onCreateView(LayoutInflater inflater, ViewGroup container,
                           Bundle savedInstanceState) {
      View view=inflater.inflate(R.layout.fragment_detail, container, false);
  
  
     Bundle getBundle = getActivity().getIntent().getExtras();
  
      String name = getBundle.getString("NAME");
      textView= (TextView) view.findViewById(R.id.bioname);
      textView.setText(name);
      imageView= (ImageView) view.findViewById(R.id.imageView);
      imageView.setImageResource(getBundle.getInt("IMAGE"));
      Log.v("test", "images are coming");
       button= (Button) view.findViewById(R.id.button_quickfacts);
      button.setOnClickListener(new View.OnClickListener() {
          @Override
          public void onClick(View v) {
              Fragment fragment = new QuickFacts();
              FragmentTransaction fragmentTransaction =
                     getFragmentManager().beginTransaction();
  
              fragmentTransaction.replace(R.id.fragment_container, fragment);
              Log.v("replace","fragment repalacd");
              fragmentTransaction.addToBackStack(null);
              fragmentTransaction.commit();
          }
      });
      return view;
  }
  </code></pre>
  
  <p>}</p>
  
  <p>fragment detail.xml</p>
  
  <pre><code>  &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:tools="http://schemas.android.com/tools"
     android:layout_width="match_parent"
     android:layout_height="match_parent"
     android:paddingBottom="@dimen/activity_vertical_margin"
     android:paddingLeft="@dimen/activity_horizontal_margin"
     android:paddingRight="@dimen/activity_horizontal_margin"
     android:paddingTop="@dimen/activity_vertical_margin"
     tools:context="com.example.rahul.famousbiography.DetailActivityFragment"
     tools:showIn="@layout/activity_detail"
     android:gravity="center_horizontal"&gt;
  
    &lt;TextView
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:id="@+id/bioname"
      android:textSize="20dp"
      android:gravity="center_vertical"
      android:textColor="#141715"
      android:layout_alignEnd="@+id/imageView"
      android:layout_alignParentTop="true"
      android:layout_alignStart="@+id/imageView" /&gt;
  
      &lt;ImageButton
      android:layout_width="150dp"
      android:layout_height="250dp"
      android:scaleType="centerCrop"
      android:id="@+id/imageView"
      android:layout_marginLeft="10dp"
      android:layout_marginRight="10dp"
      android:layout_centerHorizontal="true"
      android:layout_below="@+id/bioname" /&gt;
  
      &lt;Button
      android:id="@+id/button_quickfacts"
  
      android:text="Quick Facts"
      android:textColor="#FFFFFF"
      android:textSize="25sp"
  
      android:layout_width="150dp"
      android:layout_height="60dp"
      android:background="@drawable/quick_facts"
      android:shadowColor="#A8A8A8"
      android:shadowDx="0"
      android:shadowDy="0"
      android:shadowRadius="5"
      android:layout_below="@+id/imageView"
      android:layout_alignParentStart="true" /&gt;
      &lt;Button
      android:id="@+id/biodetail"
  
      android:text="Biography"
      android:textColor="#FFFFFF"
      android:textSize="25sp"
  
      android:layout_width="150dp"
      android:layout_height="60dp"
      android:background="@drawable/quick_facts"
      android:shadowColor="#A8A8A8"
      android:shadowDx="0"
      android:shadowDy="0"
      android:shadowRadius="5"
      android:layout_below="@+id/imageView"
      android:layout_alignParentEnd="true" /&gt;
     &lt;Button
      android:id="@+id/exit"
  
      android:text="Exit"
      android:textColor="#FFFFFF"
      android:textSize="25sp"
  
      android:layout_width="150dp"
      android:layout_height="60dp"
      android:background="@drawable/quick_facts"
      android:shadowColor="#A8A8A8"
      android:shadowDx="0"
      android:shadowDy="0"
      android:shadowRadius="5"
      android:layout_alignTop="@+id/quotes"
      android:layout_alignStart="@+id/biodetail"
      android:layout_alignParentEnd="true" /&gt;
  
     &lt;Button
      android:id="@+id/quotes"
  
      android:text="Quotes"
      android:textColor="#FFFFFF"
      android:textSize="25sp"
  
      android:layout_width="150dp"
      android:layout_height="60dp"
      android:background="@drawable/quick_facts"
      android:shadowColor="#A8A8A8"
      android:shadowDx="0"
      android:shadowDy="0"
      android:shadowRadius="5"
      android:layout_marginTop="43dp"
      android:layout_below="@+id/button_quickfacts"
      android:layout_alignParentStart="true" /&gt;
  
  
   &lt;/RelativeLayout&gt;
  </code></pre>
  
  <p>quick facts fragment class which is going to be replaced through o click</p>
  
  <pre><code> public class QuickFacts extends Fragment {
  TextView detailText;
  @Override
  public View onCreateView(LayoutInflater inflater, ViewGroup container,
                           Bundle savedInstanceState) {
      // Inflate the layout for this fragment
            View view=inflater.inflate(R.layout.fragment_quick_facts, container, false);
            Bundle getBundle = getActivity().getIntent().getExtras();
             String details=getBundle.getString("DETAIL");
             detailText= (TextView) view.findViewById(R.id.fragment_add);
             detailText.setText(details);
  
             return view;
  }
  </code></pre>
  
  <p>}
  my hosted activity </p>
  
  <p>
     
      
         </p>
  
  <pre><code>     &lt;android.support.v7.widget.Toolbar
          android:id="@+id/toolbar"
          android:layout_width="match_parent"
          android:layout_height="?attr/actionBarSize"
          android:background="?attr/colorPrimary"
          app:popupTheme="@style/AppTheme.PopupOverlay"
          android:minHeight="?actionBarSize"
  
           /&gt;
  
    &lt;/android.support.design.widget.AppBarLayout&gt;
  
  &lt;include layout="@layout/content_detail" /&gt;
  
  
  
  &lt;/android.support.design.widget.CoordinatorLayout&gt;
  </code></pre>