I want to download an image from facebook but my Bitmap is always null.
[
private void extractFacebookIcon(String id)
{
Bitmap bitmap = null;
InputStream in = null;
try
{
StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().permitAll().build();
StrictMode.setThreadPolicy( policy );
URL imageURL = new URL("http://graph.facebook.com/"+id+"/picture?type=large");
in = ( InputStream) imageURL.getContent();
bitmap = BitmapFactory.decodeStream( in );
mFacebookIcon = bitmap;
}
catch(Throwable e)
{
}]
When I use http://graph.facebook.com/"+id+"/picture?type=large
in browser, my Chrome redirects me on this link and the picture is opening and bitmap can read it.
How to solve this problem and read the first link then bitmap was not null?