title: Replace content_main with when opening a new fragment from navigation drawer
body: <p>I have googled this and am yet to find an answer,  I am using the Android Navigation drawer template, I have some fragments that replace each other when clicked from the nav menu, When the app first opens it opens on the Content_Main layout, when I click on one of my fragments it opens but the content from the content_main is still showing, I need that to hide while I use other fragments, also make a home button to allow me to go back to this content from the menu, any help ? </p>
  
  <p>The issue is when I open the app, the Content_main layout comes up, when I slide the nav drawer across and select nav_gallery in the menu the music fragment opens but the content main isnt been replaced.</p>
  
  <p>this is my MainActivity</p>
  
  <pre><code>package com.justmikey.justmik;
  
   import android.media.MediaPlayer;
   import android.os.Bundle;
   import android.support.design.widget.FloatingActionButton;
   import android.support.design.widget.Snackbar;
   import android.support.v4.app.FragmentManager;
   import android.support.v7.internal.widget.ButtonBarLayout;
   import android.text.method.ScrollingMovementMethod;
   import android.view.View;
   import android.support.design.widget.NavigationView;
   import android.support.v4.view.GravityCompat;
   import android.support.v4.widget.DrawerLayout;
   import android.support.v7.app.ActionBarDrawerToggle;
   import android.support.v7.app.AppCompatActivity;
   import android.support.v7.widget.Toolbar;
   import android.view.Menu;
   import android.view.MenuItem;
   import android.widget.Button;
   import android.widget.TextView;
  
   import JustMikey.Fragments.MainFragment;
   import JustMikey.Fragments.MusicFragment;
  
   public class MainActivity extends AppCompatActivity
      implements NavigationView.OnNavigationItemSelectedListener {
  
  //create a media player object called mp
  MediaPlayer mp;
  //declare my buttons play, pause and stop
  Button play, pause,stop;
  
  @Override
  protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_main);
  
      //Set the textView scrollMain to scrollable
      TextView tv = (TextView) findViewById(R.id.scrollMain);
      tv.setMovementMethod(new ScrollingMovementMethod());
  
      Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
      setSupportActionBar(toolbar);
  
      DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
      ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(
              this, drawer, toolbar, R.string.navigation_drawer_open,      R.string.navigation_drawer_close);
      drawer.setDrawerListener(toggle);
      toggle.syncState();
  
      NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view);
      navigationView.setNavigationItemSelectedListener(this);
       }
  
  
  
  
  @Override
  public void onBackPressed() {
      DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
      if (drawer.isDrawerOpen(GravityCompat.START)) {
          drawer.closeDrawer(GravityCompat.START);
      } else {
          super.onBackPressed();
      }
       }
  
  @Override
  public boolean onCreateOptionsMenu(Menu menu) {
      // Inflate the menu; this adds items to the action bar if it is present.
      getMenuInflater().inflate(R.menu.main, menu);
      return true;
       }
  
  @Override
  public boolean onOptionsItemSelected(MenuItem item) {
      // Handle action bar item clicks here. The action bar will
      // automatically handle clicks on the Home/Up button, so long
      // as you specify a parent activity in AndroidManifest.xml.
      int id = item.getItemId();
  
      //noinspection SimplifiableIfStatement
      if (id == R.id.action_settings) {
          return true;
      }
  
      return super.onOptionsItemSelected(item);
  }
  
  @SuppressWarnings("StatementWithEmptyBody")
  @Override
  public boolean onNavigationItemSelected(MenuItem item) {
      android.app.FragmentManager fm = getFragmentManager();
  
      int id = item.getItemId();
  
      if (id == R.id.nav_camara) {
  
     fm.beginTransaction().replace(R.id.content_frame, new MainFragment()).commit();
  
  
      } else if (id == R.id.nav_gallery) {
  
          fm.beginTransaction().replace(R.id.content_frame, new MusicFragment()).commit();
  
  
      } else if (id == R.id.nav_slideshow) {
  
      } else if (id == R.id.nav_manage) {
  
      } else if (id == R.id.nav_share) {
  
      } else if (id == R.id.nav_send) {
  
      }
  
      DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
      drawer.closeDrawer(GravityCompat.START);
      return true;
  }
   }
  </code></pre>
  
  <p>this is that content_main</p>
  
  <p></p>
  
  <pre><code>&lt;FrameLayout
      android:layout_width="fill_parent"
      android:layout_height="fill_parent"
      android:id="@+id/content_frame"&gt;
  
      &lt;ImageView
          android:layout_width="355dp"
          android:layout_height="wrap_content"
          android:src="@drawable/jmmain"
          android:id="@+id/imageView2"
          android:layout_gravity="center_horizontal|top"
          android:layout_alignRight="@+id/content_frame"
          android:layout_alignEnd="@+id/content_frame" /&gt;
  
      &lt;TextView
          android:layout_width="fill_parent"
          android:layout_height="274dp"
          android:text="hello hello hello hello hello hello hello hello hello  hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello hello "
          android:id="@+id/scrollMain"
          android:layout_gravity="center_horizontal|bottom"
          android:layout_alignBottom="@+id/scrollView"
          android:layout_alignParentLeft="true"
          android:layout_alignParentStart="true"
          android:layout_marginBottom="28dp"
          android:layout_alignParentRight="true"
          android:layout_alignParentEnd="true"
          android:background="#ffffff"
          android:padding="10dp" /&gt;
  
      &lt;ScrollView
          android:layout_width="fill_parent"
          android:layout_height="fill_parent"
          android:id="@+id/scrollView"
          android:layout_alignParentLeft="true"
          android:layout_alignParentStart="true"
          android:layout_gravity="center"&gt;&lt;/ScrollView&gt;
  
  
  &lt;/FrameLayout&gt;
  
  &lt;/RelativeLayout&gt;
  </code></pre>
  
  <p>This is my MusicFragmant </p>
  
  <pre><code>package JustMikey.Fragments;
  
  import android.app.Fragment;
  import android.graphics.LightingColorFilter;
  import android.graphics.PorterDuff;
  import android.media.MediaPlayer;
  import android.os.Bundle;
  import android.support.annotation.Nullable;
  import android.view.LayoutInflater;
  import android.view.View;
  import android.view.ViewGroup;
  import android.widget.Button;
  
  import com.justmikey.justmik.R;
  
   /**
    *     Created by James on 24/02/2016.
    */
  public class MusicFragment extends Fragment implements View.OnClickListener {
  
  //create a media player object called mp
  MediaPlayer mp;
  //declare my buttons play, pause and stop
  Button play, pause,stop;
  
  
  
  
  @Nullable
  @Override
  public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle  savedInstanceState) {
  
      View rootView = inflater.inflate(R.layout.fragmentmusic, container,  false);
  
  
      //call my button views in by using the ID tag
      play = (Button) rootView.findViewById(R.id.play);
      pause = (Button) rootView.findViewById(R.id.pause);
      stop = (Button) rootView.findViewById(R.id.stop);
  
      //set an onClickListener to make my buttons clickable
      play.setOnClickListener(this);
      pause.setOnClickListener(this);
      stop.setOnClickListener(this);
  
      //Change the colour of the pause button for a nice design effect
      pause.getBackground().setColorFilter(new LightingColorFilter(0x00000000,  0xFFAA0000));
      //return the view
      return rootView;
  }
  // onClick Method for the play, pause and stop buttons
  public void onClick(View v) {
      switch(v.getId()) {
          case R.id.play : if(mp == null) {
              mp = MediaPlayer.create(getActivity(), R.raw.holdmytong);
          }
              mp.start();
              break;
          case R.id.pause : mp.pause();break;
  
          case R.id.stop : mp.stop();mp = null;break;
      }
  
      }
  
  
  
  }
  </code></pre>
  
  <p>The fragment_music layout </p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  </code></pre>
  
  <p></p>
  
  <pre><code>&lt;ImageView
      android:layout_width="fill_parent"
      android:layout_height="wrap_content"
      android:adjustViewBounds="true"
      android:scaleType="fitCenter"
      android:id="@+id/imageView3"
      android:src="@drawable/jmholdmy"
      android:layout_gravity="center_horizontal|top" /&gt;
  
  &lt;Button
      style="?android:attr/buttonStyleSmall"
      android:layout_width="100dp"
      android:layout_height="74dp"
      android:id="@+id/pause"
      android:layout_alignTop="@+id/play"
      android:layout_toRightOf="@+id/play"
      android:layout_toEndOf="@+id/play"
      android:layout_gravity="center_horizontal|bottom"
      android:background="@drawable/pausebtnimg" /&gt;
  
  &lt;Button
      style="?android:attr/buttonStyleSmall"
      android:layout_width="113dp"
      android:layout_height="72dp"
      android:id="@+id/stop"
      android:layout_alignTop="@+id/play"
      android:layout_toRightOf="@+id/pause"
      android:layout_toEndOf="@+id/pause"
      android:layout_gravity="right|bottom"
      android:background="@drawable/stopbtnimg" /&gt;
  
  &lt;Button
      style="?android:attr/buttonStyleSmall"
      android:layout_width="114dp"
      android:layout_height="72dp"
      android:id="@+id/play"
      android:layout_marginTop="170dp"
      android:layout_alignParentLeft="true"
      android:layout_alignParentStart="true"
      android:layout_gravity="left|bottom"
      android:background="@drawable/playbtnimg" /&gt;
  
  &lt;TextView
      android:layout_width="match_parent"
      android:layout_height="258dp"
      android:id="@+id/textView4"
      android:layout_gravity="left|bottom"
      android:text="Taking from our debut EP Hold my tongue was our first released song, it won play at the Picnic competition which brought Just Mikey to the stage at the largest festivil in Europe Electric Picnic, This is the first of many to come so enjoy.  " /&gt;
  
  &lt;TextView
      android:layout_width="314dp"
      android:layout_height="156dp"
      android:text="Buy Track: https://www.facebook.com/search/top/?q=just%20mikey%20google%20play"
      android:id="@+id/textView5"
      android:layout_gravity="center_horizontal|bottom"
      android:backgroundTint="#000000"
      android:backgroundTintMode="screen" /&gt;
  </code></pre>
  
  <p></p>