til icon indicating copy to clipboard operation
til copied to clipboard

Problem when cannot load facebook profile image on android

Open siliconprime-thanhduc opened this issue 6 years ago • 0 comments

When Khanh implement Welcome Back UI on Sol, he needs to load facebook profile image onto ImageView.

He has a problem when we use Glide to load this URL, Glide cannot load it, and if you click this link by browser, it's will download this image and don't show anything. It'so weird, because it just a link to show an image.

So after reviewing the code, we easy to fix it with type one word. http change to https

eg: http://graph.facebook.com/2536187389726079/picture?type=large to https://graph.facebook.com/2536187389726079/picture?type=large

It easy, right?

Another way to load the facebook profile image onto view:

We will use ProfilePictureView ( widget of Facebook SDK)

<com.facebook.login.widget.ProfilePictureView
    android:id="@+id/image"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_centerInParent="true"
    facebook:preset_size="small"/>

After that, you can set facebook id like this in code

profilePictureView.setProfileId(facebookUserId);

siliconprime-thanhduc avatar May 17 '19 08:05 siliconprime-thanhduc