Android异步请求网络上的图片,返回数据为数据流
2018-07-20 来源:open-open
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);
}
}
标签:
版权申明:本站文章部分自网络,如有侵权,请联系:west999com@outlook.com
特别注意:本站所有转载文章言论不代表本站观点!
本站所提供的图片等素材,版权归原作者所有,如需使用,请与原作者联系。
最新资讯
热门推荐