Ank*_*kit 0 android facebook bitmap
这是我正在使用的代码.
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();
}
Run Code Online (Sandbox Code Playgroud)
当我在浏览器中使用此URL时,它会显示图像,但是当尝试在位图中获取它时,它会给出null.
我检查了很多问题,但没有任何帮助.
这段代码适用于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();
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
941 次 |
| 最近记录: |