title: Android Fragment opening another fragment
body: <p>I am new to android development, and situation here is simple: 
  There's a fragment that's being called by MainActivity, where the fragment is being replaced with the frameLayout. And now, what I want here is to open up a fragment that contains the detail information from the following onItemClick.</p>
  
  <pre><code>public void onItemClick(AdapterView&lt;?&gt; parent, View view, int position, long id) {
              Fragment w = new statDetail();
              getActivity().getSupportFragmentManager().beginTransaction().add(w,"detail").addToBackStack(null).commit();
          }
  //From MainActivity
  @Override
  public void onNavigationDrawerItemSelected(int position) {
  // update the main content by replacing fragments
      FragmentManager fragmentManager = getSupportFragmentManager();
      if (position==0) {
          fragmentManager.beginTransaction()
                  .replace(R.id.container, ExpenseFragment.newInstance(position + 1))
                  .commit();
      }
      else {
          fragmentManager.beginTransaction()
                  .replace(R.id.container, StatFragment.newInstance(position + 1))
                  .commit();
      }
  }
  </code></pre>
  
  <p>Above is the code that I'm trying to accomplish to open up another fragment, but it simply stops the whole program. OnItemClick works fine here, and I have already tried just creating a new activity, but because this uses the pre-made navigationdrawer that android studio provides, pressing back button would come to the first page when I wanted to show up the 2nd page, which I have no idea how to modify. I feel like fragment would be easier to use here, but I really don't know. </p>
  
  <p>In the future, I want to implement the back navigation and would appreciate if anyone can help me solve the problem! Thanks!</p>