- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我已经为我的项目设置了一个 OnSelectionChangedListener,如下所示:
friendPickerFragment.setOnSelectionChangedListener(new PickerFragment.OnSelectionChangedListener() {
@Override
public void onSelectionChanged(PickerFragment<?> fragment){
FriendPickerApplication application = (FriendPickerApplication) getApplication();
application.setSelectedUsers(friendPickerFragment.getSelection());
setResult(RESULT_OK, null);
finish();
}
});
这与 facebook sdk 示例应用程序“FriendPickerSample”中的 OnDoneButtonClickedListener 中的格式完全相同。我收到错误
java.lang.ClassCastException: android.app.Application cannot be cast to com.garrenkeith.facebook.FriendPickerApplication
我正在寻找一种解决方案来修复在选择用户时将所选用户添加到应用程序的代码。
最佳答案
检查 list 文件。您可能还没有配置您的 FriendPickerApplication
<application>
中的类标签。
此外,您确定需要子类化“Application”吗?来自 Android 文档:
There is normally no need to subclass Application. In most situation, static singletons can provide the same functionality in a more modular way. If your singleton needs a global context (for example to register broadcast receivers), the function to retrieve it can be given a Context which internally uses Context.getApplicationContext() when first constructing the singleton.
关于java - Facebook SDK friendPickerFragment.setOnSelectionChangedListener 导致 android 项目出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19888836/
我想在其他 fragment 中显示 FriendPickerFragment 但我得到空列表请帮助我找不到关于他们的任何信息 这是布局 这是 fragment 代码 公共(public)类
我使用的是 facebook-android-sdk 版本 4.0.0。他们的网站说“这个类在最新版本的 SDK 中不再可用。”所以,显然这个类不再可用。我想知道他们是否用更好的解决方案替换了它,或者
知道为什么列表可能是空的吗? 代码如下。 public class PickFBFriendsActivity extends FragmentActivity { FriendPickerFragm
我使用的是提供的很棒的 FriendPickerFragment,但 Facebook SDK for Android。 它实际上是一个很棒的工具,可以节省我很多时间,但它确实缺少一个重要的功能。 我
还有其他人遇到过来自 Facebook 的 FriendPickerFragment 的性能问题吗?我正在按照显示好友 ( https://developers.facebook.com/docs/t
我意识到我在 Why is my friend picker fragment empty? 上遇到的问题 fragment 是否运行良好,只是因为我使用的是 facebook 图表版本 2.0,它只
在 facebook SDK“Facebook SDK 3.0 for Android 的新功能”页面上,在“Ready-to-Use native UI views”下声明:“Friend Pick
我已经为我的项目设置了一个 OnSelectionChangedListener,如下所示: friendPickerFragment.setOnSelectionChangedListener(ne
我正在使用 Facebook SDK 3.5,我有点困惑。如果我使用 FriendPickerFragment(来自他们的示例),它会用 friend 列表填充 fragment ,但我只想拥有 JS
我是一名优秀的程序员,十分优秀!