本文介绍了获得零位,同时试图让使用Facebook的ID Facebook的图片的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
这是在code我使用。
This is the code I'm using.
String imageURL;
Bitmap bitmap = null;
imageURL = "http://graph.facebook.com/" + fbID + "/picture?type=";
try {
bitmap = BitmapFactory.decodeStream((InputStream) new URL(imageURL)
.getContent());
} catch (Exception e) {
e.printStackTrace();
}
当我使用这个网址,浏览器,它显示的图像,但试图得到它的位图时,它给了空。
when i use this URL in browser it shows image, but when trying to get it in bitmap it gives null.
我检查了很多的问题,但没有帮助我。
I've checked many question, but nothing help me.
推荐答案
这code工作对我来说与HTTPGET:
This code works for me with HTTPGet:
HttpGet httpRequest = new HttpGet(URI.create(linkUrl) );
HttpClient httpclient = new DefaultHttpClient();
HttpResponse response = (HttpResponse) httpclient.execute(httpRequest);
HttpEntity entity = response.getEntity();
BufferedHttpEntity bufHttpEntity = new BufferedHttpEntity(entity);
bmap = BitmapFactory.decodeStream(bufHttpEntity.getContent());
httpRequest.abort();
这篇关于获得零位,同时试图让使用Facebook的ID Facebook的图片的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!