use of com.example.android.bitmapfun.util.ImageCache.ImageCacheParams in project AndroidDynamicLoader by mmin18.
the class ImageGridFragment method onCreate.
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setHasOptionsMenu(true);
MyResources res = MyResources.getResource(ImageGridFragment.class);
mImageThumbSize = res.getResources().getDimensionPixelSize(R.dimen.image_thumbnail_size);
mImageThumbSpacing = res.getResources().getDimensionPixelSize(R.dimen.image_thumbnail_spacing);
// The empty_photo bitmap is in our package, so we use res.getResources() instead of context.getResources()
Bitmap emptyPhoto = BitmapFactory.decodeResource(res.getResources(), R.drawable.empty_photo);
mAdapter = new ImageAdapter(getActivity());
ImageCacheParams cacheParams = new ImageCacheParams(getActivity(), IMAGE_CACHE_DIR);
// Set memory cache to 25% of app memory
cacheParams.setMemCacheSizePercent(0.25f);
// The ImageFetcher takes care of loading images into our ImageView children asynchronously
mImageFetcher = new ImageFetcher(getActivity(), mImageThumbSize);
mImageFetcher.setLoadingImage(emptyPhoto);
mImageFetcher.addImageCache(getActivity().getFragmentManager(), cacheParams);
}
Aggregations