我正在尝试让 ShareActionProvider 工作,但遇到了以下问题:
此代码有效:
Intent shareIntent = new Intent(Intent.ACTION_SEND);
shareIntent.setType("text/plain");
shareIntent.putExtra(Intent.EXTRA_TEXT, "Text I want to share");
MenuItem shareItem = menu.findItem(R.id.share);
mShareActionProvider = (ShareActionProvider) shareItem.getActionProvider();
mShareActionProvider.setShareIntent(shareIntent);
但这不会:
Intent shareIntent = new Intent(Intent.ACTION_SEND);
shareIntent.setType("text/plain");
shareIntent.putExtra(Intent.EXTRA_TEXT, webView.getUrl());
MenuItem shareItem = menu.findItem(R.id.share);
mShareActionProvider = (ShareActionProvider) shareItem.getActionProvider();
mShareActionProvider.setShareIntent(shareIntent);
这是为什么?