title: Share Button on Action Bar?
body: <p>I am currently building an app where I need to share an image. I have done the XML and the share button appears, but you can't click on it.</p>
  
  <p>Here is my code for the button in XML:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;menu xmlns:android="http://schemas.android.com/apk/res/android" &gt;
      &lt;item android:id="@+id/menu_item_scan"
            android:icon="@drawable/scanlogo"
            android:showAsAction="ifRoom"
            android:title="Scan" /&gt;
      &lt;item android:id="@+id/menu_item_share"
            android:showAsAction="ifRoom"
            android:title="Share"
            android:actionProviderClass="android.widget.ShareActionProvider" /&gt;
  &lt;/menu&gt;
  </code></pre>
  
  <p>This is where I inflate the menu:</p>
  
  <pre><code>public boolean onCreateOptionsMenu(Menu menu) {
      getMenuInflater().inflate(R.menu.action_bar_share_menu, menu);
      return true;
  }
  </code></pre>
  
  <p>This all works and it shows up, but it is not clickable. Here is where I try to make it clickable:</p>
  
  <pre><code>public boolean onOptionsItemSelected(MenuItem item) {
          // Handle presses on the action bar items
          switch (item.getItemId()) {
              case R.id.menu_item_share:
                  Intent ShareIntent = new Intent();
                  String pathofBmp = MediaStore.Images.Media.insertImage(getContentResolver(), QRMap,"QRCode", null);
                  Uri bmpUri = Uri.parse(pathofBmp);
                  ShareIntent.setAction(Intent.ACTION_SEND);
                  ShareIntent.putExtra(Intent.EXTRA_STREAM, bmpUri);
  
  
    ShareIntent.setType("image/png");
              mShareActionProvider.setShareIntent(ShareIntent);
              return true;
  
          default:
              return super.onOptionsItemSelected(item);
      }
  }
  </code></pre>
  
  <p>Any help would be much appreciated!</p>