When i say "not works" i mean that seems not clickable
ActivityChooserView
, the action view ShareActionProvider
returns, disables the "share" button when there are no items to display, which in your case if because you're setting up ShareActionProvider
incorrectly. All of the "on click" events are handled internally, you won't receive any callbacks to ActionMode.Callback.onActionItemClicked
.
Rather than settings it up in ActionMode.Callback.onActionItemClicked
, move that code into ActionMode.Callback.onCreateActionMode
and call Menu.findItem
to initialize it.
@Override
public boolean onCreateActionMode(ActionMode mode, Menu menu) {
mode.getMenuInflater().inflate(R.menu.cab, menu);
final MenuItem item = menu.findItem(R.id.your_share_action_provider_id);
mshare = (ShareActionProvider) item.getActionProvider();
mshare.setShareIntent(Share());
return true;
}