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

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);  
		}
	
	}



你可能感兴趣的:(安卓异步请求网络上的图片,返回数据为数据流)