2

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()));
InnocentKiller
  • 5,234
  • 7
  • 36
  • 84
Lior Z
  • 668
  • 1
  • 9
  • 21

3 Answers3

1

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

Community
  • 1
  • 1
Noam
  • 1,018
  • 7
  • 18
1

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.

aguyngueran
  • 1,301
  • 10
  • 23
0

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..

Community
  • 1
  • 1
Rony Tesler
  • 1,207
  • 15
  • 25