Created
January 7, 2014 08:42
-
-
Save laaptu/8296396 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Override | |
public boolean onPrepareOptionsMenu(Menu menu) { | |
// getMenuInflater().inflate(R.menu.text_menu, menu); | |
getMenuInflater().inflate(R.menu.actionview_menu, menu); | |
// menu.getItem(0).setVisible(false); | |
this.menu = menu; | |
MenuItem shareItem = menu.findItem(R.id.action_share); | |
ShareActionProvider actionProvider = (ShareActionProvider) MenuItemCompat | |
.getActionProvider(shareItem); | |
Intent intent = new Intent(Intent.ACTION_SEND); | |
intent.setType("text/plain"); | |
intent.putExtra(Intent.EXTRA_TEXT, "Test ShareActionView"); | |
actionProvider.setShareIntent(intent); | |
return super.onPrepareOptionsMenu(menu); | |
} | |
//you can add this onCreateOptionsMenu as well ,but you need to inflate menu at there |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment