In my application, I want to share images at runtime when the user clicks on it.
There are two images when the user clicks on the first image and then clicks on the second image at the same time. I am extracting a bitmap of the first image of the image and assigning a second image for this, I used the following code:
public Bitmap createBitmap(ImageView imageview) { imageview.setDrawingCacheEnabled(true); imageview.buildDrawingCache(false); if(imageview.getDrawingCache() != null) { Bitmap bitmap = Bitmap.createBitmap(imageview.getDrawingCache()); imageview.setDrawingCacheEnabled(false); return bitmap; } else { return null; } }
The code works fine, but the cache is not cleared every time and the bitmap created using the previous cache, so how can I clear the cache in raster form?
android bitmap
Prachi
source share