Code example for LruCache

Methods: put

    protected void addBitmapToMemoryCache(String key, Bitmap bitmap) {
        if (getBitmapFromMemCache(key) == null) {
            mMemoryCache.put(key, bitmap);
    protected Bitmap getBitmapFromMemCache(String key) {
        return mMemoryCache.get(key);
    public static Bitmap decodeSampledBitmapFromResource(Resources res, int resId,
                                                         int reqWidth, int reqHeight) {
        // First decode with inJustDecodeBounds=true to check dimensions 
        final BitmapFactory.Options options = new BitmapFactory.Options();
Contextual code suggestions in your IDE  Get Codota for Java