android - How to download image from facebook Graph API -
i want download image facebook bitmap 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 use http://graph.facebook.com/"+id+"/picture?type=large
in browser, chrome redirects me on link , picture opening , bitmap can read it.
how solve problem , read first link bitmap not null?
i think it's because facebook send application redirect url. have @ http://www.mkyong.com/java/java-httpurlconnection-follow-redirect-example/ see how can handle redirects (httpredirectexample code).
Comments
Post a Comment