Okay, so you created a social share menu item and inflated it in your ActionBar making it look like this.
Then, when you click on it, nothing happens. How so?
You need to attach a share Intent in the ShareActionProvider object. Add this sample short piece of code after your menu gets inflated.
That should make it clickable.
|
1 2 3 4 5 6 7 8 |
ShareActionProvider provider = (ShareActionProvider) menu.findItem(R.id.menu_share).getActionProvider(); if (provider != null) { Intent shareIntent = new Intent(); shareIntent.setAction(Intent.ACTION_SEND); shareIntent.putExtra(Intent.EXTRA_TEXT, "TEST MESSAGE"); shareIntent.setType("text/plain"); provider.setShareIntent(shareIntent); } |