I'm trying to use the ShareActionProvider from a PopupMenu which is displayed after clicking an item of a listView. The problem is that the share menu doesn't display the icons as they should be.
another problem appears when I click on the "see all" item, another share menu appears!
The XML configuration of the popupMenu looks like that:
thanks for your help
another problem appears when I click on the "see all" item, another share menu appears!
Code:
public void openVideoMenu(View view) {
PopupMenu popup = new PopupMenu(this, view);
MenuInflater inflater = popup.getMenuInflater();
inflater.inflate(R.menu.video_menu, popup.getMenu());
ShareActionProvider mShareActionProvider = (ShareActionProvider) popup.getMenu().findItem(R.id.share).getActionProvider();
Intent sendIntent = new Intent(Intent.ACTION_SEND);
sendIntent.setType("text/plain");
sendIntent.putExtra(Intent.EXTRA_TEXT, "http://www.youtube.com/watch?v="+ id);
mShareActionProvider.setShareIntent(sendIntent);
popup.show();
}
Code:
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android" >
<item
android:id="@+id/share"
android:title="@string/share"
android:showAsAction="always"
android:icon="@drawable/ic_action_share"
android:actionProviderClass="android.widget.ShareActionProvider"/>
</menu>