【发布时间】:2016-06-04 15:19:39
【问题描述】:
我有一个分享按钮。我与一些文本和 URL 共享一条消息。它适用于 whatsapp、Twitter 和 Gmail。但是,在 facebook 分享中,我只能分享网站链接。之后,在网上搜索我找到了 Facebook 共享的 ShareDialog 类。我的问题是当用户单击 android 默认共享对话框上的 facebook 图标时如何检测(例如:onClick() 用于 facebook 图标)。这是正确的方法吗?还是有其他替代品?
我的代码:
public void shareApp() {
Intent sendIntent = new Intent();
String websiteLink = "https://www.manam.com";
String playStoreLink = "http://www.google.com";
String msg = "\nHey, found this cool & easy on-demand app.";
sendIntent.setAction(Intent.ACTION_SEND);
sendIntent.putExtra(Intent.EXTRA_SUBJECT, msg);
sendIntent.putExtra(Intent.EXTRA_TEXT,playStoreLink + msg);
sendIntent.setType("text/plain");
startActivity(Intent.createChooser(sendIntent, ""));
}
【问题讨论】:
标签: android