ActionProvider itemProvider = item.getActionProvider();
ShareActionProvider provider = null;
if (!(itemProvider instanceof ShareActionProvider)) {
provider = new ShareActionProvider(callingActivity);
} else {
provider = (ShareActionProvider) itemProvider;
}
provider.setShareHistoryFileName(HISTORY_FILENAME_PREFIX +
callingActivity.getClass().getName());
provider.setShareIntent(intent);
item.setActionProvider(provider);