public Bitmap loadImage(String url) { if (null == url) return null; Bitmap bitmap = null; bitmap = mImageLoader.getBitmapFromMemoryCache(url); // 从内存拿图片 if (null != bitmap) { return bitmap; } // 从SD卡拿图片 File imgFile = new File(Utils.getImagePath(url)); if (!imgFile.exists()) { Utils.downloadImage(url, columnWidth); // 网络下载图片 } bitmap = ImageLoader.decodeSampledBitmapFromResource(imgFile.getPath(), columnWidth - 10); return bitmap; }
public WaterFallViews(Context context, AttributeSet attrs) { super(context, attrs); mImageLoader = ImageLoader.getInstance(); all_container = this; }