小编WiK*_*o.O的帖子

打开 Facebook 用户个人资料 Android

当我尝试通过官方 Facebook 应用程序打开 Facebook 个人资料时,出现此错误:加载传记时出错,内容不可用。我尝试了很多代码,但没有。仅当设备上未安装 Facebook 应用程序时,浏览器才能正常工作。这是当前的代码:

try
 {
   Intent followIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("fb://profile/"+id_facebook));
                                                            startActivity(followIntent);
   final Handler handler = new Handler();
   handler.postDelayed(new Runnable()
   {
     @Override
     public void run() {
         Intent followIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("fb://profile/"+id_facebook));
         startActivity(followIntent);
     }
   }, 1000 * 2);
 }
catch (Exception e)
 {
   startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("https://www.facebook.com/"+id_facebook)));
   String errorMessage = (e.getMessage()==null)?"Message is empty":e.getMessage();
   Log.e("Unlock_ScreenActivity:FacebookAppNotFound" ,errorMessage);
 }
Run Code Online (Sandbox Code Playgroud)

更新:

当我放弃只放https URI时,Android让我在Facebook APP和浏览器之间进行选择,我喜欢它!所以我的问题得到了回答=D

android facebook

3
推荐指数
1
解决办法
1453
查看次数

标签 统计

android ×1

facebook ×1