title: Why do I have to press back to get back to my main activity?
body: <p>I'm having an issue developing an android app, what is happening is that when I try to press the back button from in my fragment view, It appears to close to an exact copy of the same fragment. If I press back again it then goes to my main activity(which I want to happen the first time the button is pressed)?</p>
  
  <p>Here's my window that calls the fragment </p>
  
  <pre><code>    public class DaysWindow extends ActionBarActivity {
  
  @Override
  protected void onCreate(Bundle savedInstanceState) {
       super.onCreate(savedInstanceState);
       setContentView(R.layout.activity_days_window);
          // Get the message from the intent
          Intent intent = getIntent();
          String message = intent.getStringExtra(MainActivity.EXTRA_MESSAGE);
          Scanner scan = new Scanner(message);
          scan.useDelimiter(";");
  
          if(savedInstanceState==null){
  
  
  
              DaysFragment days = new DaysFragment();
              days.setArguments(intent.getExtras());
              getSupportFragmentManager().beginTransaction()
              .add(R.id.container, days).commit();
  
          getSupportActionBar().setDisplayHomeAsUpEnabled(true);
          }
  }
  
  @Override
  public boolean onCreateOptionsMenu(Menu menu) {
  
      // Inflate the menu; this adds items to the action bar if it is present.
      getMenuInflater().inflate(R.menu.days_window, menu);
      return true;
  }
  
      }
  </code></pre>
  
  <p>And here's the fragment I'm seeing twice</p>
  
  <pre><code>    public class DaysFragment extends android.support.v4.app.Fragment {
  String days;
  String message;
  
  
  public View onCreateView(LayoutInflater inflater, ViewGroup Container, Bundle       SavedInstanceState){
  
      View view=inflater.inflate(R.layout.fragment_days, Container, false);
      days=getArguments().getString(MainActivity.EXTRA_MESSAGE);
      TextView textView= (TextView) view.findViewById(R.id.DaysTextView);
      Scanner scan = new Scanner(days);
      scan.useDelimiter(";");
      textView.setText(scan.next());
  
  
      return view;
      }
      } 
  </code></pre>