gpt4 book ai didi

android - 使用 picasso 获取用户的Facebook个人资料图片

转载 作者:太空狗 更新时间:2023-10-29 15:30:41 25 4
gpt4 key购买 nike

我正在使用 Parse 作为后端,我正在尝试获取用户个人资料图片并显示它。我不想使用 ProfilePictureView,因为我使用的是也显示其他 imageView 的 gridview。如您所见,我也在使用 gravater api。

所以问题是:它不会显示个人资料图片,只会显示占位符图片(头像工作正常并显示),我做错了什么?

   ParseUser user = mUsers.get(position);
String email;
if (user.getEmail() == null) { // this is how i check if its a facebook
// user

ParseUser currentUser = user;
if (currentUser.get(ParseConstants.KEY_FACEBOOK_DETAILS) != null) {
JSONObject userProfile = currentUser
.getJSONObject(ParseConstants.KEY_FACEBOOK_DETAILS);
try {
if (userProfile.getString("facebookId") != null) {
String facebookId = userProfile.get("facebookId")
.toString();
String facebookName = userProfile.getString("name");
holder.nameLabel.setText(facebookName);
// holder.userImageView.setProfileId(facebookId);
String facebookProfilePicUrl = "http://graph.facebook.com/"
+ facebookId + "/picture";

Picasso.with(mContext).load(facebookProfilePicUrl)
.placeholder(R.drawable.avatar_empty)
.into(holder.userImageView);
}
} catch (JSONException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}

}
} else {

email = user.getEmail().toLowerCase(Locale.getDefault());
if (email.equals("")) {
holder.userImageView.setImageResource(R.drawable.avatar_empty);
} else {
String hash = MD5Util.md5Hex(email);
String gravatarUrl = "http://www.gravatar.com/avatar/" + hash
+ "?s=204&d=404";
Picasso.with(mContext).load(gravatarUrl)
.placeholder(R.drawable.avatar_empty)
.into(holder.userImageView);
}
holder.nameLabel.setText(user.getUsername());
}

GridView gridView = (GridView) parent;
if (gridView.isItemChecked(position)) {
holder.checkImageView.setVisibility(View.VISIBLE);
} else {
holder.checkImageView.setVisibility(View.INVISIBLE);
}

return convertView;

最佳答案

已从 http 更改为 https。解决了。​​

关于android - 使用 picasso 获取用户的Facebook个人资料图片,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23787325/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com