首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >打开Android应用程序的社交网络配置文件url?

打开Android应用程序的社交网络配置文件url?
EN

Stack Overflow用户
提问于 2014-12-05 09:12:52
回答 1查看 1.7K关注 0票数 1

从我的Android应用程序,我想打开一个链接到社交网络个人资料(Facebook / Twitter / Google Plus / Youtube / Linkedin)的官方社交网络应用程序(当然,如果应用程序安装)。

如何从代码中打开官方社交网络应用程序中的社交网络配置文件?

我成功地在Facebook上使用了这段代码:现在我想为其他社交应用程序( Twitter / Google Plus / Youtube / Linkedin )做同样的事情。

代码语言:javascript
运行
复制
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")));
                }

            }
        });
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2014-12-05 11:30:54

和Facebook一样,使用twitter://user?user_id=id_num调用Twitter。您可以存储这些in并在这里使用它们,也可以将它们手动放到您的调用中。干杯!

Google+:

代码语言:javascript
运行
复制
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("https://plus.google.com/id_goes_here/posts")));

代码语言:javascript
运行
复制
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:

代码语言:javascript
运行
复制
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("vnd.youtube:VIDEO_ID")));
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/27312377

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档