0

When i was trying to get the bitmap image from facebook url, it showing bitmap is null. here is my code.

URL url = new URL("http://graph.facebook.com/100006480449004/picture?type=large");
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
connection.setDoInput(true);
connection.connect();
InputStream input = connection.getInputStream();
Bitmap myBitmap = BitmapFactory.decodeStream(input);
srinu_stack
  • 117
  • 1
  • 2
  • 7
  • there is apparently a redirection here. You probably need to tell httpUrlConnection to follow it. – njzk2 Jul 10 '14 at 14:48

1 Answers1

0

Enter the URL into your browser, this will forward you to the correct URL of the pic, ending on .jpg

Or you enable redirecting via connection.setInstanceFollowRedirects(true);

PKlumpp
  • 4,913
  • 8
  • 36
  • 64