Issue
I am trying to display the Facebook profile image using Glide in an ImageView once the user logs in, the problem is that Glide only loads the default image from Facebook, I have tried different ways but it always loads the same image by default.
This is the image that Glide shows
Here is my code:
onCreate method:
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 method:
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);
}
Solution
According to your comment:
when I put the URL in the browser, it shows me the same image by default.
This means that the getPhotoUrl() method that exists in the FirebaseUser class, returns an URL that points to a valid photo. However, that photo is added automatically by Facebook when the users decide not to add any photos to the profile. So if a user doesn't have any photos, the default photo will always be displayed. So when you try to read the photo that is associated to such an account, the default photo will be displayed.
Answered By - Alex Mamo
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.