title: Android - Navigation drawer fragments
body: <p>I have implemented navigation drawer in my android app. but now I want to be able to change the layout using fragments when the user clicks any list item in the navigation bar. 
  Here is what I have got so far: </p>
  
  <p><strong>XML</strong></p>
  
  <pre><code>&lt;android.support.v4.widget.DrawerLayout
      xmlns:android="http://schemas.android.com/apk/res/android"
      android:id="@+id/drawer_layout"
      android:orientation="horizontal"
      android:layout_width="match_parent"
      android:layout_height="match_parent"&gt;
  
      &lt;FrameLayout
          android:id="@+id/content_frame"
          android:layout_width="match_parent"
          android:background="#000000"
          android:layout_height="match_parent" &gt;       
      &lt;/FrameLayout&gt;
  
      &lt;ListView android:id="@+id/left_drawer"
          android:layout_width="220dp"
          android:layout_height="match_parent"
          android:layout_gravity="start"
          android:choiceMode="singleChoice"
          android:divider="@android:color/transparent"
          android:dividerHeight="0dp"
          android:background="#111"/&gt;
  &lt;/android.support.v4.widget.DrawerLayout&gt;
  </code></pre>
  
  <p><strong>Java File</strong></p>
  
  <pre><code>public class MainActivity extends Activity {
  final String[] data ={"one","two","three"};
  
  @Override
  protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_main);
  
      ArrayAdapter&lt;String&gt; adapter = new ArrayAdapter&lt;String&gt;(this, android.R.layout.simple_list_item_1, data);
  
      final DrawerLayout drawer = (DrawerLayout)findViewById(R.id.drawer_layout);
      final ListView navList = (ListView) findViewById(R.id.left_drawer);
      navList.setAdapter(adapter);
      navList.setOnItemClickListener(new AdapterView.OnItemClickListener(){
          @Override
          public void onItemClick(AdapterView&lt;?&gt; parent, View view, final int pos,long id){
              drawer.setDrawerListener( new DrawerLayout.SimpleDrawerListener(){
                  @Override
                  public void onDrawerClosed(View drawerView){
                      super.onDrawerClosed(drawerView);
  
                  }
              });
              drawer.closeDrawer(navList);
          }
      });
    }
  }
  </code></pre>
  
  <p>Using the above code, I implemented navigation drawer in my app and I see "one", "two" and "Three" list items in the navigation drawer but nothing happens when I click on them except the drawer closes.
  So, my question is :
  <strong>How do I add the fragment functionality to the above given code?</strong></p>
  
  <p>I am beginner. Thanks in advance!</p>