我正在努力在所有默认可用的应用程序中进行文本共享,例如 facebook、gmail 等。
我在这里放了我的代码的快照。
final Intent emailIntent1 = new Intent(
android.content.Intent.ACTION_SEND);
emailIntent1.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
emailIntent1.setAction("https://play.google.com/store");
emailIntent1.putExtra(Intent.EXTRA_TEXT,"https://play.google.com/store");
emailIntent1.setType("image/png");
startActivity(Intent.createChooser(emailIntent1, "send"));
我的问题是,我无法在 facebook 中分享文本。
非常感谢您的回答。
最佳答案
试试这个...
Intent shareIntent = new Intent(Intent.ACTION_SEND);
shareIntent.setType("text/plain");
shareIntent.putExtra(Intent.EXTRA_SUBJECT, "Share this app");
String shareMessage = "https://play.google.com/store";
shareIntent.putExtra(Intent.EXTRA_TEXT, shareMessage);
startActivity(Intent.createChooser(shareIntent, "Choose the messenger to share this App"));
关于android - 如何使用默认的 android 共享( Intent )将文本共享到 facebook?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35126326/