打开从Android应用程序Facebook页面?应用程序、页面、Android、Facebook

2023-09-06 13:26:02 作者:我还以为她爱

我如何开始的意图打开一个Facebook应用程序在手机上,然后导航到prefered页的Facebook?

How can I start an intent to open a Facebook application on a phone and navigate to the prefered page in Facebook?

我想:

Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setClassName("com.facebook.katana", "com.facebook.katana.ProfileTabHostActivity");
intent.putExtra("extra_user_id", "123456789l");
this.startActivity(intent);

好吧,不管我写为1234567891,它总是浏览到我的网页。总是给我,而不是别的。

Well, whatever I write to "1234567891", it is always navigating to my page. Always to me and not else.

我怎么能这样做呢?

推荐答案

我有完全一样的问题,发送的用户ID,但由于某种原因,我的个人资料总是开了朋友的个人资料,而不是。

I had the exactly same problem, sent the user id but for some reason, my profile always opened instead of the friend's profile.

现在的问题是,如果你通过了字符串对象重新$ P $的psents Facebook的UID,甚至基本类型,其目的将无法稍后阅读。你需要传递一个真实的

The problem is that if you pass the String of the Long object that represents the Facebook UID, or even a long primitive type, the intent won't be able to read it later. You need to pass a real Long.

所以,完整的code是:

So the complete code is:

    Intent intent = new Intent(Intent.ACTION_VIEW);
    intent.setClassName("com.facebook.katana", "com.facebook.katana.ProfileTabHostActivity");
    Long uid = new Long("123456789");
    intent.putExtra("extra_user_id", uid);
    startActivity(intent);

好享受,并希望这会有所帮助: - )

Ok enjoy and hope this helps :-)

美信