mob_web_dev
mob_web_dev

Reputation: 2362

Bitmap gets null when getting facebook profile picture

I'm trying to get my facebook profile picture by

URL fb_pic = new URL("http://graph.facebook.com/"+(facebookuserID)+"/picture?style=small" );

Ihave successfully got the image url.But when i try to convert the url into Bitmap i'm not getting response,

Bitmap bit = BitmapFactory.decodeStream(fb_pic.openConnection().getInputStream());

Please give me a solution...!!!

Upvotes: 2

Views: 687

Answers (1)

malar
malar

Reputation: 21

This code is working for me

HttpGet httpRequest = new HttpGet(URI.create(linkUrl) ); 
HttpClient httpclient = new DefaultHttpClient(); 
HttpResponse response = (HttpResponse) httpclient.execute(httpRequest); 
HttpEntity entrty = response.getEntity(); 
BufferedHttpEntity bufHttpEntity = new BufferedHttpEntity(entity); 
bmap = BitmapFactory.decodeStream(bufHttpEntity.getContent());

httpRequest.abort();

Upvotes: 2

Related Questions