I would like to know the exact usage of PrepareToDraw() in Bitmap class. Actually my understanding is, if the bitmap is recycled and if draw() is called after prepareToDraw(), it should be drawn without throwing exception(Since bimap will be rebuilt). Here is the code snippet.
BitmapFactory.Options mOptions = new BitmapFactory.Options();
mOptions.inPurgeable = true;
mOptions.inInputShareable = true;
InputStream is = getResources().openRawResource(R.drawable.test5);
b=BitmapFactory.decodeStream(is,new Rect(1, 1, 1, 1),mOptions);
canvas.drawBitmap(b,0, 150, mPaint);
canvas.drawText(e.toString(), 0, 200, mPaint);
canvas.drawBitmap(b,0, 220, mPaint);
canvas.drawText(e.toString(), 0, 220, mPaint);
But, RuntimeException: Canvas: trying to use a recycle bitmap was the output for both drawBitmap() function call. So i couldnt get the complete understanding of prepareToDraw().
It will be helpful, if anybody could help me out in this.