- 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);
- }
- }
来源: http://www.phpxs.com/code/1002127/