如何通过Android的facebook api将用户导航到Facebook页面?

Ada*_*gyi 2 android facebook facebook-graph-api

可能重复:
从其他应用程序启动Facebook应用程序

我是facebook api的初学者,我必须说文档非常糟糕.现在我可以从我的应用程序发布到我的墙上并添加一些内容,但我无法在互联网上找到如何用我想要的页面打开Facebook.

谁能告诉我怎么做?

Adi*_*mro 8

如果你想通过在android官方facebook应用程序中提供FB页面ID来打开特定页面,请执行以下操作:

try {
      //try to open page in facebook native app.
      String uri = "fb://page/" + yourFBpageId;    //Cutsom URL
      Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(uri));
      startActivity(intent);   
}catch (ActivityNotFoundException ex){
      //facebook native app isn't available, use browser.
      String uri = "http://touch.facebook.com/pages/x/" + yourFBpageId;  //Normal URL  
      Intent i = new Intent(Intent.ACTION_VIEW, Uri.parse(uri));    
      startActivity(i); 
}
Run Code Online (Sandbox Code Playgroud)

fb app支持的完整URL方案可以在这里找到.