title: how to return to previous fragment activity
body: <p>Three fragment activities: <code>MainFragmentActivity</code>, <code>Reports</code> and <code>ReportsType</code>.</p>
  
  <p>Reports is calling <code>ReportsType</code>. </p>
  
  <p>There is a back button in <code>ReportsType</code> to go back with the following code:</p>
  
  <pre><code>public void goBackReport(View v)
      {
         finish(); // why MainFragmentActivity.java is called after finish()?
      }
  </code></pre>
  
  <p>But its always returning to <code>MainFragmentActivity.java</code>. But it should be <code>Reports.java</code>.</p>
  
  <p><strong>UPDATE:</strong></p>
  
  <p><strong>Reports.java</strong></p>
  
  <pre><code>public void showReport(View v) {
          String tag = v.getTag().toString();
      Intent i5 = new Intent(this, ReportsType.class);
      i5.putExtra("name", tag);
      FragmentTransactiontransaction=getSupportFragmentManager().beginTransaction();
          transaction.addToBackStack(null).commit();
          startActivity(i5);
  
      }
  </code></pre>
  
  <p><strong>ReportsType.java</strong></p>
  
  <pre><code>public void goBackReport(View v)
      {
         getSupportFragmentManager().popBackStack(); //nothing happens
      }
  </code></pre>