public Bitmap createBitmap ( ) { Bitmap bitmap = null ; Canvas canvas = null ; for ( int layer = 0 ; layer < 4 ; layer ++ ) { Bitmap layerBitmap = layeredBitmap [ layer ] ; if ( layerBitmap != null ) { if ( bitmap == null ) { bitmap = layerBitmap ; canvas = layeredCanvas [ layer ] ; } else { canvas . drawBitmap ( layerBitmap , new Matrix ( ) , null ) ; layerBitmap . recycle ( ) ; } layeredBitmap [ layer ] = null ; layeredCanvas [ layer ] = null ; } } return bitmap ; }
Create the final bitmap from the layers resets the layers