This has me baffled. I need to copy the Bitmap from one ImageView into another. I do not want to simply copy one ImageView to another because I need to do some changes to the bitmap on its way over.
Here is some code that doesn't work.
ImageView ivSrc = (ImageView) findViewById(R.id.photo);
ivSrc.setDrawingCacheEnabled(true);
Bitmap bmSrc1 = ivSrc.getDrawingCache(); // will cause nullPointerException
Bitmap bmSrc2 = Bitmap.createBitmap(ivSrc.getDrawingCache());//bmSrc2 will be null
View vSrc = (View) ivSrc.getParent();
vSrc.setDrawingCacheEnabled(true);
Bitmap bmSrc3 = Bitmap.createBitmap(vSrc.getDrawingCache()); //black bitmap
//To test the bitmaps:
ImageView ivDest = (ImageView) findViewById(R.id.photo2);
ivDest.setImageBitmap(bmSrc1); //bmSrc1, 2, 3 results shown above
I have to going about this wrong because doing a copy should be so easy. TIA