从我的Android应用程序,我想打开一个链接到社交网络个人资料(Facebook / Twitter / Google Plus / Youtube / Linkedin)的官方社交网络应用程序(当然,如果应用程序安装)。
如何从代码中打开官方社交网络应用程序中的社交网络配置文件?
我成功地在Facebook上使用了这段代码:现在我想为其他社交应用程序( Twitter / Google Plus / Youtube / Linkedin )做同样的事情。
ImageView img = (ImageView) findViewById(R.id.fb);
img.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
try {
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("fb://profile/1531870783738030"));
startActivity(intent);
} catch (Exception e) {
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("http://www.facebook.com/ultimatesoftwaredeveloper")));
}
}
});发布于 2014-12-05 11:30:54
和Facebook一样,使用twitter://user?user_id=id_num调用Twitter。您可以存储这些in并在这里使用它们,也可以将它们手动放到您的调用中。干杯!
Google+:
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("https://plus.google.com/id_goes_here/posts")));或
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setClassName("com.google.android.apps.plus",
"com.google.android.apps.plus.phone.UrlGatewayActivity");
intent.putExtra("customAppUri", "FAN_PAGE_ID");
startActivity(intent);Youtube:
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("vnd.youtube:VIDEO_ID")));https://stackoverflow.com/questions/27312377
复制相似问题