android - Facebook在android中的 fragment 登录

标签 android facebook facebook-graph-api android-fragments facebook-login

我正在尝试使用自定义界面登录 Facebook,它在 Activity 类中运行良好。我也必须在 Fragment 中做同样的事情。但回调没有执行。是不是不能在Fragment的OnActivityResult中添加CallbackResult??

最佳答案

您只需在 Activity onActivityResult 中添加此代码即可。

for (Fragment fragment : getSupportFragmentManager().getFragments()) {
            //System.out.println("@#@");
            fragment.onActivityResult(requestCode, resultCode, data);
        }

那么您的 onActivityResult fragment 肯定会起作用。

   @Override
        public void onActivityResult(final int requestCode, final int resultCode, final Intent data) {


            callbackManager.onActivityResult(requestCode, resultCode, data);
        }

关于android - Facebook在android中的 fragment 登录,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34736301/

相关文章:

php - 从 Facebook id 中获取 Facebook 名称 - file_get_contents() 不起作用

javascript - Facebook Messenger 获取消息应用程序的访问 token

facebook - 错误无效范围 : offline_access, publish_stream,当我尝试连接 Facebook API

spring - 为什么 Spring Social facebook -2.0.3 使用已弃用的图 api 版本 2.5(已弃用)

Facebook照片分享到 friend 的墙

android - 如何在android中获取fb用户照片?

android - 当应用程序提示用户时唤醒设备

安卓 GPS 修复 & getFromLocation

android - xamarin 表单中的自动宽度或高度

android - 使用opengles在android中的纹理之间切换