这是在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();