[英]how can I use the standard Fragment of the android SDK with facebook SDK?
I use facebook library compile 'com.facebook.android:facebook-android-sdk:4.4.0'
我使用facebook库
compile 'com.facebook.android:facebook-android-sdk:4.4.0'
And I use method: 我使用方法:
LoginManager.getInstance().logInWithReadPermissions(this, Arrays.asList("public_profile", "user_friends", "email"));
The problem is that before I passed this
- Fragment from appcompat-v7:22.2.0'
and everything worked But now i pass Fragment from android.app.Fragment
and method logInWithReadPermissions
does not accept it. 问题在于,在我通过
this
之前-来自appcompat-v7:22.2.0'
Fragment一切正常,但现在我从android.app.Fragment
传递Fragment,并且方法logInWithReadPermissions
不接受它。
On the Facebook site i found: enter link description here 在我发现的Facebook网站上: 在此处输入链接描述
but no one says how can I use the standard Fragment of the android SDK with facebook 但是没有人说我如何在Facebook上使用android SDK的标准片段
That's because the Facebook SDK's LoginManager
expects a android.support.v4.app.Fragment
instead. 这是因为Facebook SDK的
LoginManager
期望使用android.support.v4.app.Fragment
来代替。
You can do it by passing the activity
, like this 您可以通过传递
activity
来做到这一点,就像这样
LoginManager.getInstance().logInWithReadPermissions(getActivity(), Arrays.asList("public_profile", "user_friends", "email"));
Please check the latest Facebook SDK: 请检查最新的Facebook SDK:
compile 'com.facebook.android:facebook-android-sdk:4.10.0'
It now supports standard fragment too. 现在,它也支持标准片段。 LoginManager has 3 functions now:
LoginManager现在具有3个功能:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.