简体   繁体   English

Android Facebook SDK Session.OpenRequest(myFragment)是否未定义?

[英]Android Facebook sdk Session.OpenRequest(myFragment) is undefined?

For some reason I cannot see the line of code: 由于某种原因,我看不到代码行:

session = new Session.OpenRequest(this).setCallBack(statusCallBack)

It gives me an error that Session.OpenRequest(myFragment) is undefined. 它给我一个错误,即Session.OpenRequest(myFragment)未定义。 Does anyone know why this is and how I can fix it? 有谁知道这是为什么以及我该如何解决?

Found out what i was doing wrong. 找出我在做什么错。 It has to be a fragment from the support library. 它必须是支持库中的片段。 I was extending the regular fragment class. 我正在扩展常规片段类。

Apparently, Session.OpenRequest(Fragment fragment) constructor should work. 显然, Session.OpenRequest(Fragment fragment)构造函数应该可以工作。 Assuming that you have added Facebook SDK properly in your project, organize the imports in your class to import the Session.OpenRequest class. 假设您已在项目中正确添加Facebook SDK,则在您的类中组织导入以导入Session.OpenRequest类。 This constructor seems to be invisible for your code. 该构造函数对于您的代码似乎是不可见的。

If you are using Eclipse IDE organize imports by pressing Ctrl + Shift + O . 如果您使用的是Eclipse IDE,请按Ctrl + Shift + O组织导入。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM