- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我试图在不实现 Facebook 登录按钮的情况下显示 Facebook 个人资料图片。我正在使用 Facebook SDK。
目前我的头像是这样的:
我成功连接到 Facebook 并使用 com.facebook.widget.ProfilePictureView
在 xml
中显示空个人资料图片
现在我在尝试检索我的个人资料图片的 java 类中遇到了问题:
游戏.java
@Override
protected void onCreate(Bundle savedInstanceState) {
...
...
// Find the user's profile picture custom view
profilePictureView = (ProfilePictureView) findViewById(R.id.selection_profile_pic);
profilePictureView.setCropped(true);
// view that in turn displays the profile picture.
profilePictureView.setProfileId(GraphUser.getId()); //eror
...
...
}
错误与此行有关:profilePictureView.setProfileId(GraphUser.getId())
在教程中,他们会像这样显示个人资料图片:
@Override
public void onCompleted(GraphUser user, Response response) {
// If the response is successful
if (session == Session.getActiveSession()) {
if (user != null) {
// Set the id for the ProfilePictureView
// view that in turn displays the profile picture.
profilePictureView.setProfileId(user.getId());
// Set the Textview's text to the user's name.
userNameView.setText(user.getFirstName());
}
}
if (response.getError() != null) {
// Handle errors, will do so later.
}
}
但就我而言,我没有登录 session ,只想加载一张快速个人资料照片。所以我尝试简单地用 profilePictureView.setProfileId(user.getId());
代替 profilePictureView.setProfileId(GraphUser.getId());
因为 user
类型为 GraphUser
编译错误:当我编写 profilePictureView.setProfileId(GraphUser.getId());
时,它说无法从类型 GraphUser 对非静态方法 getId() 进行静态引用
有人可以帮我加载我的个人资料照片吗?如果不先实现 Facebook 登录,这可能吗?
最佳答案
没有授权用户,用户是完全匿名的。所以答案是否定的,没有登录你就不能显示任何东西,而且你当然不能在没有登录的情况下获得用户 ID(这是获得个人资料图片所需要的)。用户 ID 甚至可以让您访问每个用户的真实姓名。当然,未经授权这是不可能的。
有关登录的更多信息(在 Android 上):https://developers.facebook.com/docs/android/login-with-facebook/v2.2
关于android - 不登录显示个人资料图片,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27910215/
我正在使用passport.js 为我的node.js 应用程序提供OAuth 身份验证。但我确实有一个疑问: 当我在身份验证时收到配置文件对象(当您定义 OAuth 策略时)时,该对象对于所有提供商
我正在尝试对 wordpress 布局进行解码/逆向工程。我正在浏览 CSS 文件,无法弄清楚这个长长的菜单 mumbo-jumbo 是什么! 我不是要任何人检查代码,而是让我知道我在看什么。这些似乎
所以我尝试制作一个包含私有(private)配置文件的 symfony 项目,并且我使用 FriendsOfSymfony,但是如果我创建两个用户,每个人都可以看到其他人上传的文件。我尝试在多个网站上
我正在编写一个需要使用已登录 G+ 用户的公开个人资料图片的 JS 应用。 如果我有用户 ID,我可以使用 Google+ API 查询个人资料数据。 https://developers.googl
我看过很多关于 facebook 身份验证的帖子,要么是旧的,要么不能正常工作。 然而,最终我在我的项目中做了一些可行但不完全的东西。这是我要求的代码 var facebookAuth
我是一名优秀的程序员,十分优秀!