Lior Z
Lior Z

Reputation: 668

Facebook Image not Loading in Android

I'm loading Facebook images in my Android app, and it worked perfectly until this morning when I started getting:

SkImageDecoder::Factory returned null 

indicating that the image was not available. I checked it with an image from another url, and the code still works, so I figured Facebook must be having some trouble… does anyone know about this?

Here's the code I use:

URL img_value = null;
img_value = new URL("http://graph.facebook.com/" + userId + "/picture?type=" + type);
retval = BitmapFactory.decodeStream(new BufferedInputStream(img_value.openConnection().getInputStream()));

Upvotes: 2

Views: 889

Answers (3)

Rony Tesler
Rony Tesler

Reputation: 1401

I had the same problem and found a solution here:

Getting null bitmap while trying to get Facebook image using Facebook ID

I would like to know what has changed..

Upvotes: 0

aguyngueran
aguyngueran

Reputation: 1321

The same happened with my Android application.

I'm not sure because I cannot recall what was before but now this HTTP request is being redirected to HTTPS.

And Android HttpURLConnection does support up to five redirects but not when there is HTTP <-> HTTPS change, I guess.

You could try to change http into https. There is still a chance that FB will change this in the future again.

Upvotes: 1

Noam
Noam

Reputation: 1018

Notice that they redirect you with 302 to other url. It seems like your code doesn't handle that.

Maybe this will help: Httpclient redirect handler

Upvotes: 1

Related Questions