Android异步请求网络上的图片,返回数据为数据流,,private clas
分享于 点击 24533 次 点评:258
Android异步请求网络上的图片,返回数据为数据流,,private clas
private class ErweimaAsyncTask extends AsyncTask<String, Integer, String>{ @Override protected String doInBackground(String... paramArray) { URL picUrl; try { picUrl = new URL(Constant.ERWEIMA_URL + "?timestimp=" + new Date().getTime() + "&code=BILLID_" + globalVariables.getCurrentBillId()); pngBM = BitmapFactory.decodeStream(picUrl.openStream()); } catch (MalformedURLException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } return ""; } @Override protected void onPostExecute(String result) { erweimaImg.setImageBitmap(pngBM); } }
用户点评