Android 加载服务器上的图片

来源:互联网 发布:淘宝运营大概多少提成 编辑:程序博客网 时间:2024/06/06 01:07
  1.         public Bitmap getRemoteImage(finalURL aURL) {
  2.                 try {
  3.                         finalURLConnection conn = aURL.openConnection();
  4.                         conn.connect();
  5.                         finalBufferedInputStream bis = new BufferedInputStream(conn.getInputStream());
  6.                         final Bitmap bm= BitmapFactory.decodeStream(bis);
  7.                         bis.close();
  8.                         is.close();
  9.                         return bm;
  10.                 } catch (IOException e){
  11.                         Log.d("DEBUGTAG","Oh noooz an error...");
  12.                 }
  13.                 return null;
  14.         }