title: Android app is closing on press of back button
body: <p>I have a menu and when clicked on a menu, it goes inside another menu.
  for example, mainmenu-->click on airport guide --> menu2
   but when i am in menu2 and  press on the back button, the app is closing instead of going back to mainmenu . i am not able to figure out the problem here. i am new to android development</p>
  
  <pre><code>package com.shashank.sharjahinternationalairport;
  
  import android.app.Activity;
  import android.os.Bundle;
  import android.view.Menu;
  import android.view.View;
  import android.view.View.OnClickListener;
  import android.widget.ImageButton;
  
  public class MainActivity extends Activity {
  ImageButton flightInfoButton;
  ImageButton airportGuideButton;
  ImageButton visitorInfoButton;
  ImageButton saaDcaButton;
  ImageButton cargoButton;
  
  
  @Override
  public void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);
  setContentView(R.layout.activity_main);
  
  flightInfoButton = (ImageButton) findViewById(R.id.flightInfo);
  airportGuideButton = (ImageButton) findViewById(R.id.airportGuide);
  visitorInfoButton = (ImageButton) findViewById(R.id.visitorInfo);
  saaDcaButton = (ImageButton) findViewById(R.id.saaDca);        
  cargoButton = (ImageButton) findViewById(R.id.cargo);
  
  airportGuideButton.setOnClickListener(new OnClickListener(){
  @Override
  public void onClick(View V){
  
      setContentView(R.layout.airport_guide);
  
    }
   });
    visitorInfoButton.setOnClickListener(new OnClickListener(){
      @Override
      public void onClick(View V){
  
          setContentView(R.layout.visitor_info);
  
      }
    });
    saaDcaButton.setOnClickListener(new OnClickListener(){
      @Override
      public void onClick(View V){
  
          setContentView(R.layout.saa_dca);
  
       }
       });
     }
  
  
  @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;
  }
  </code></pre>