作者热门文章
- c - 在位数组中找到第一个零
- linux - Unix 显示有关匹配两种模式之一的文件的信息
- 正则表达式替换多个文件
- linux - 隐藏来自 xtrace 的命令
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/
我是一名优秀的程序员,十分优秀!