Android: Bug with ThreadSafeClientConnManager downloading images

前端 未结 11 1470
我寻月下人不归
我寻月下人不归 2020-12-23 23:12

For my current application I collect images from different \"event providers\" in Spain.

  Bitmap bmp=null;
  HttpGet httpRequest = new HttpGet(strURL);

  l         


        
11条回答
  •  谎友^
    谎友^ (楼主)
    2020-12-24 00:11

    HttpGet httpRequest = null;
    try {
      httpRequest = new HttpGet(url);
    } catch (Exception e) {
      e.printStackTrace();
    }
    HttpClient httpclient = new DefaultHttpClient();
    HttpResponse response = (HttpResponse) httpclient.execute(httpRequest);
    HttpEntity entity = response.getEntity();
    BufferedHttpEntity bufHttpEntity = new BufferedHttpEntity(entity); 
    InputStream instream = bufHttpEntity.getContent();
    Bitmap bm = BitmapFactory.decodeStream(instream);
    

提交回复
热议问题