List of usage examples for android.widget ImageView destroyDrawingCache
@Deprecated public void destroyDrawingCache()
Frees the resources used by the drawing cache.
From source file:Main.java
public static void stripImageView(ImageView view) { if (view.getDrawable() instanceof BitmapDrawable) { ((BitmapDrawable) view.getDrawable()).getBitmap().recycle(); }/*from w w w.ja v a 2s .c o m*/ view.getDrawable().setCallback(null); view.setImageDrawable(null); view.getResources().flushLayoutCache(); view.destroyDrawingCache(); }
From source file:org.odk.collect.android.widgets.QuestionWidget.java
public void recycleDrawables() { List<ImageView> images = new ArrayList<>(); // collect all the image views recycleDrawablesRecursive(this, images); for (ImageView imageView : images) { imageView.destroyDrawingCache(); Drawable d = imageView.getDrawable(); if (d != null && d instanceof BitmapDrawable) { imageView.setImageDrawable(null); BitmapDrawable bd = (BitmapDrawable) d; Bitmap bmp = bd.getBitmap(); if (bmp != null) { bmp.recycle();// ww w . j ava 2 s . c om } } } }