title: Tabbed Activity and Menu in Toolbar
body: <p>I have a Tabbed Activity with 3 different tabs with fragments.
  I have a Toolbar too and in this Toolbar i have 1 static menu object and 1 dynamic object.</p>
  
  <p>I put the static object (bluetooth connection) into MainActivity that contains Fragments loaded into a container and the dynamic button into the Fragment that need that button.</p>
  
  <p>The problem is that if i declare the method of menu into MainActivity, the methods declared into fragments are useless and when i press the icon nothing happends....
  But if i delete the method that manage menu into MainActivity now the buttons into fragments works...</p>
  
  <p>There is some way to around this thing?
  Or the only way is to repeat to every fragments the static button and for each fragment add the specific buttons that other fragments don't need?</p>
  
  <p>MainActivity menu method:</p>
  
  <pre><code>@Override
  public boolean onCreateOptionsMenu(Menu menu) {
      // Inflate the menu; this adds items to the action bar if it is present.
      getMenuInflater().inflate(R.menu.menu_main, menu);
      return true;
  }
  
  @Override
  public boolean onOptionsItemSelected(MenuItem item) {
      // Handle action bar item clicks here. The action bar will
      // automatically handle clicks on the Home/Up button, so long
      // as you specify a parent activity in AndroidManifest.xml.
      switch (item.getItemId()) {
          case R.id.action_bluetooth:
  
              if (mBluetoothService == null) {
                  Log.d(TAG, "menu Bluetooth button");
  
                  setupComunication();
              } else {
  
                  mBluetoothService = null;
  
                  setupComunication();
              }
              // Launch the DeviceListActivity to see devices and do scan
              Intent serverIntent = new Intent(this, DeviceListActivity.class);
              startActivityForResult(serverIntent, REQUEST_CONNECT_DEVICE_INSECURE);
              //findDevice();
              return true;
  
          default:
              return super.onOptionsItemSelected(item);
      }
  }
  </code></pre>
  
  <p>Fragment menu method:</p>
  
  <pre><code>@Override
  public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
      // Inflate the menu; this adds items to the action bar if it is present.
      inflater.inflate(R.menu.menu_dashboard, menu);
      super.onCreateOptionsMenu(menu, inflater);
  }
  
  @Override
  public boolean onOptionsItemSelected(MenuItem item) {
      // Handle action bar item clicks here. The action bar will
      // automatically handle clicks on the Home/Up button, so long
      // as you specify a parent activity in AndroidManifest.xml.
      switch (item.getItemId()) {
          case R.id.action_commands:
              // User chose the "Settings" item, show the app settings UI...
              Intent settingsIntent = new Intent(getActivity(), SettingsActivity.class);
              startActivityForResult(settingsIntent, RESULT_SETTINGS);
              return true;
          default:
              return super.onOptionsItemSelected(item);
      }
  }
  </code></pre>