Determine if ShareActionProvider is triggered
<p>I am having problems with the ShareActionProvider. I like to share the current url of an webview (url can be changed dynamically via JS) via a ShareActionProvider. To do this I overwrote onOptionsItemSelected to change the Intent via setShareIntent. But when I click on the ShareActionProvider and share it via a specific application, nothing happens. I debugged it and I found out that onOptionsItemSelected is not triggered. Can somebody help me out?</p>

<pre><code>public boolean onCreateOptionsMenu(Menu menu) {
    getMenuInflater().inflate(R.menu.game, menu);

    MenuItem mShareActionProviderItem = (MenuItem) menu.findItem(R.id.action_share);
    mShareActionProvider = (ShareActionProvider) mShareActionProviderItem.getActionProvider(); // is a field
    Intent sendIntent = new Intent(Intent.ACTION_SEND);
    sendIntent.setType("text/plain");
    mShareActionProvider.setShareIntent(sendIntent); //needed to be able to click on Item

    mShareActionProviderItem.getActionView().setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            String url = ((GameFragment) getFragmentManager().findFragmentByTag(GAME_FRAGMENT)).getUrl();

            /*ShareButton set URL*/
            Intent sendIntent = new Intent(Intent.ACTION_SEND);
            sendIntent.setType("text/plain");
            sendIntent.putExtra(Intent.EXTRA_TEXT, String.format(getResources().getString(R.string.share_text), url));
            mShareActionProvider.setShareIntent(sendIntent);
        }
    });
    return true;
}

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    switch(item.getItemId()) {
        case R.id.action_share:
            /*URL holen*/
            String url = ((GameFragment) getFragmentManager().findFragmentByTag(GAME_FRAGMENT)).getUrl();

            /*ShareButton mit URL bestücken*/
            ShareActionProvider mShareActionProvider = (ShareActionProvider) item.getActionProvider();
            Intent sendIntent = new Intent(Intent.ACTION_SEND);
            sendIntent.setType("text/plain");
            sendIntent.putExtra(Intent.EXTRA_TEXT, String.format(getResources().getString(R.string.share_text), url));
            mShareActionProvider.setShareIntent(sendIntent);
            break;
        default:
            return super.onOptionsItemSelected(item);
    }
    return true;
</code></pre>
