title: pass boolean intent between two activities
body: <p>I have toggle bottun to display the service status  in the actionbar in the <code>MainActivity</code> and <code>Map</code> activity. After clicking a button, the user is being redirected to the map activity.  The boolean <code>serviceStauts</code> variable is to dectect the status of the service in both activity. I am facing problem to pass the boolean as intent to the map activity since the value is ture at the start  in the MainActivity and I am getting <code>false</code> in the map activity for <code>serviceStauts</code> when I click the button of the checklist (I am not touching the icon in the actionbar)!?</p>
  
  <p>Can guide me why I am getting false in the map activity?</p>
  
  <p><strong>MainActivity:</strong></p>
  
  <pre><code>public class MainActivity extends ActionBarActivity {
  boolean serviceStauts = true;
   ....
      private void createCheckboxList(final ArrayList&lt;Integer&gt; items) {
                          Intent serviceStatusIntent = new Intent(MainActivity.this, Map.class);
                          serviceStatusIntent.putExtra("booleanServicfeStatus", serviceStauts);
                          startActivity(serviceStatusIntent);
       }
   .... 
  
  
  @Override
      public boolean onOptionsItemSelected(MenuItem item) {
      switch (item.getItemId()) {
          case R.id.menu_toggle:
  
              if (serviceStauts) {
                  item.setIcon(R.drawable.off);
                  item.setTitle("OFF");
                  serviceStauts = false;
                  mService.stopTrackingService();
                  System.out.println("ABC Map onOptionsitemSelected OFF");            
  
              } else {
                  item.setIcon(R.drawable.on);
                  item.setTitle("ON");
                  serviceStauts = true;
                  Intent i = new Intent(this, TrackingService.class);
                  startService(i);
                  System.out.println("ABC Map onOptionsitemSelected ON");
  
              }
          }
          return super.onOptionsItemSelected(item);
  }
  
      }
  </code></pre>
  
  <p><strong>Map activity:</strong></p>
  
  <pre><code>public class Map extends ActionBarActivity {
  boolean serviceStauts;
  
      @Override
      protected void onNewIntent(Intent intent) {
          super.onNewIntent(intent);      
          serviceStauts = getIntent().getExtras().getBoolean("booleanServicfeStatus");
    }
      @Override
      public boolean onPrepareOptionsMenu(Menu menu) {
          System.out.println("ABC MAP onPrepareOptionsMenu was invoked.");
          MenuItem item = menu.findItem(R.id.menu_toggle);
          if(serviceStauts){
              item.setIcon(R.drawable.on);
          }else{
              item.setIcon(R.drawable.off);
          }
  
          return super.onPrepareOptionsMenu(menu);
      }
  }
  </code></pre>