从webbu加载图像时抛出异常

时间:2011-05-26 10:33:35

标签: android image

1 个答案:

答案 0 :(得分:0)

使用此方法下载图片。

  HttpGet httpRequest = null;
            httpRequest = new HttpGet(url);
            HttpClient httpclient = new DefaultHttpClient();
            HttpResponse response = (HttpResponse) httpclient.execute(httpRequest);
            HttpEntity entity = response.getEntity();
            BufferedHttpEntity bufHttpEntity = new BufferedHttpEntity(entity); 
            InputStream instream = bufHttpEntity.getContent();
            bitmap= BitmapFactory.decodeStream(instream);