I have this intent
Button share = (Button)findViewById(R.id.share);
share.setOnClickListener(new Button.OnClickListener()
{
public void onClick(View v)
{
//createShareIntent( );
}
});
and these two methods in the class:
@Override
public boolean onCreateOptionsMenu(Menu menu)
{
getMenuInflater().inflate(R.layout.menu, menu);
MenuItem item = menu.findItem(R.id.menu_item_share);
myShareActionProvider = (ShareActionProvider)item.getActionProvider();
myShareActionProvider.setShareHistoryFileName(
ShareActionProvider.DEFAULT_SHARE_HISTORY_FILE_NAME);
myShareActionProvider.setShareIntent(createShareIntent());
return true;
}
private Intent createShareIntent()
{
Intent shareIntent = new Intent(Intent.ACTION_SEND);
shareIntent.setType("text/plain");
shareIntent.putExtra(Intent.EXTRA_TEXT,
"testing");
return shareIntent;
}
public void doShare(Intent shareIntent)
{
// When you want to share set the share intent.
myShareActionProvider.setShareIntent(shareIntent);
}
and this sdk version configuration:
<uses-sdk android:minSdkVersion="4" android:targetSdkVersion="15"/>
But my problm is that I do not know how to call this. How do I actually get the menu to show up after the share button is clicked?
Thanks!