【发布时间】:2021-08-05 04:55:53
【问题描述】:
一旦用户登录,我试图在 ImageView 中使用 Glide 显示 Facebook 个人资料图像,问题是 Glide 仅从 Facebook 加载默认图像,我尝试了不同的方式,但默认情况下它总是加载相同的图像.
This is the image that Glide shows
这是我的代码:
onCreate 方法:
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_menu, container, false);
if (AccessToken.getCurrentAccessToken() == null){
goLoginScreen();
}else {
Profile profile = Profile.getCurrentProfile();
if (profile != null){
displayProfileInfo(profile);
}else{
Profile.fetchProfileForCurrentAccessToken();
}
}
return view;
}
displayProfileInfo 方法:
private void displayProfileInfo(Profile profile){
String name = profile.getName();
String photoUrl = profile.getProfilePictureUri(100,100).toString();
txtviewUname.setText(name);
Glide.with(getActivity()).load(photoUrl).into(profileImage);
}
【问题讨论】:
-
默认图片是什么意思?你关注API Docs了吗?
-
你能给我们看一个“来自 Facebook 的默认图片”的例子吗?请回复@AlexMamo
-
收到url后在logcat中打印photoUrl变量数据,然后点击浏览器
-
@AlexMamo 嗨,我用截图更新了问题,这就是我所说的默认图像
-
嗨,我用屏幕截图更新了问题,当我将网址放入浏览器时,默认情况下它会显示相同的图像。所以问题是图片网址?我怎样才能得到正确的网址? @MuhammadAsad
标签: java android firebase android-studio