gpt4 book ai didi

android - 如何在 android 中打开 Facebook 和 Twitter

转载 作者:太空狗 更新时间:2023-10-29 16:21:41 25 4
gpt4 key购买 nike

  Intent i = new Intent(Intent.ACTION_SEND);    
i.setType("text/html");
String str = et.getText().toString();
i.putExtra(android.content.Intent.EXTRA_TEXT,str);
startActivity(Intent.createChooser(i,"Share using"));

我无法在 Android 中使用此代码打开 Facebook 和 Twitter,但可以成功打开 Gmail 和 Skype 等其他应用程序。为什么?以及如何打开 Facebook 和 Twitter?

最佳答案

你能试试这段代码吗:

private void facebooktaPaylas() {
try {
String facebookUri = "http://m.facebook.com/sharer.php?u=";
String marketUri = "your sharing text");
Intent shareOnFacebookIntent = new Intent(Intent.ACTION_VIEW,
Uri.parse(facebookUri + marketUri));
startActivity(shareOnFacebookIntent);
} catch (Exception e) {
e.printStackTrace();
}
}

private void twitterdaPaylas() {
try {
String facebookUri = "http://mobile.twitter.com/home?status=";
String marketUri = "your sharing text";
Intent shareOnFacebookIntent = new Intent(Intent.ACTION_VIEW,
Uri.parse(facebookUri + marketUri));
startActivity(shareOnFacebookIntent);
} catch (Exception e) {
e.printStackTrace();
}
}

关于android - 如何在 android 中打开 Facebook 和 Twitter,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12928078/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com