Android异步请求网络上的图片,返回数据为数据流

2015-03-26 0 908
Android异步请求网络上的图片,返回数据为数据流
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); 
        }
     
    }

遇见资源网 java Android异步请求网络上的图片,返回数据为数据流 http://www.ox520.com/9098.html

常见问题

相关文章

发表评论
暂无评论
官方客服团队

为您解决烦忧 - 24小时在线 专业服务