android 获取 图片 缩略图

引用:http://www.iteye.com/topic/1114018

  1. byte[] imageByte=getImageFromURL(urlPath.trim());   
  2.             //以下是把图片转化为缩略图再加载  
  3.             BitmapFactory.Options options = new BitmapFactory.Options();   
  4.             options.inJustDecodeBounds = true;  
  5.             BitmapFactory.decodeByteArray(imageByte, 0, imageByte.length,options);   <span style="font-family: Helvetica, Tahoma, Arial, sans-serif; font-size: 14px; line-height: 25px; white-space: normal;"//此时返回bitmap为空 </span>  
  6.             options.inJustDecodeBounds = false;  
  7.             int be = (int)(options.outHeight / (float)200);   
  8.             if (be <= 0){  
  9.                 be = 1;   
  10.             }  
  11.             options.inSampleSize = be;       
  12.             return BitmapFactory.decodeByteArray(imageByte, 0, imageByte.length,options);  //返回缩略图  
posted @ 2011-12-22 17:40  镇水古月  阅读(444)  评论(0编辑  收藏  举报