Can Anyone Tell me why Canvas.throwifrecycled Occur in this code
<p><strong>I Have Class Called ShowCanvas Which Extends View I  Have Two Bitmap Inside In it Which I move One Bitmap over Another... The Problem Occur In This Code  is "Canvas.ThrowIfRecycled " I Dnt Know This Problem Occur "</strong></p>

<pre><code>public class ShowCanvas extends View {

Bitmap CanvasBitmap;
Bitmap ScaledBitmap;
Bitmap overlaybitmap;
private static final int INVALID_POINTER_ID = -1;
static boolean truevalue = false;

private Drawable mImage;
private float mPosX;
private float mPosY;
Bitmap bit;
private float mLastTouchX;
private float mLastTouchY;
private int mActivePointerId = INVALID_POINTER_ID;
int touchState;
final int IDLE = 0;
final int TOUCH = 1;
final int PINCH = 2;
float dist0, distCurrent;
private Bitmap resizedBitmap;

private ScaleGestureDetector mScaleDetector;
private float mScaleFactor = 1.f;

GestureDetector gesturedetector;
private float bmpHeight;
private float bmpWidth;

int Scaled_X;
int scaled_Y;
private Matrix matrix;

public ShowCanvas(Context context) {
    this(context, null, 0);
    // TODO Auto-generated constructor stub

    ScaledBitmap = DrawView.scaled;

  **Here I convert Bitmap As a Drawable Image **

    mImage = new BitmapDrawable(getResources(), Dress.bitmap);

    System.out.println("mImage" + mImage);
</code></pre>

<p><strong>Here Again i convert Drawable Image To A Bitmap Image</strong></p>

<pre><code>    bit = ((BitmapDrawable) mImage).getBitmap();
    bmpWidth = bit.getWidth();
    bmpHeight = bit.getHeight();

    mImage.setBounds(0, 0, mImage.getIntrinsicWidth(),
            mImage.getIntrinsicHeight());

    distCurrent = 1; // Dummy default distance
    dist0 = 1; // Dummy default distance
    drawMatrix();
    touchState = IDLE;

}

private void drawMatrix() {
    // TODO Auto-generated method stub

    float curScale = distCurrent / dist0;
    if (curScale &lt; 0.1) {
        curScale = 0.1f;
    }

    int newHeight = (int) (bmpHeight * curScale);
    int newWidth = (int) (bmpWidth * curScale);

    resizedBitmap = Bitmap.createScaledBitmap(bit, newWidth, newHeight,
            false);

    System.out.println("ResizesdBitmap" + resizedBitmap);

    System.out.println("ScaledBitmap" + ScaledBitmap);

}

public ShowCanvas(Context context, AttributeSet attrs) {
    this(context, attrs, 0);
}

public ShowCanvas(Context context, AttributeSet attrs, int defStyle) {
    super(context, attrs, defStyle);
    mScaleDetector = new ScaleGestureDetector(context, new ScaleListener());
    gesturedetector = new GestureDetector(new MyGesturedetector(this));

}

public void setBitmap(Bitmap bitmap) {
    // TODO Auto-generated method stub
    CanvasBitmap = bitmap;

}

@Override
public boolean onTouchEvent(MotionEvent ev) {
    // Let the ScaleGestureDetector inspect all events.
    float distx, disty;

    gesturedetector.onTouchEvent(ev);

    mScaleDetector.onTouchEvent(ev);

    final int action = ev.getAction();

    switch (action &amp; MotionEvent.ACTION_MASK) {

    case MotionEvent.ACTION_DOWN: {

        touchState = TOUCH;
        final float x = ev.getX();
        final float y = ev.getY();

        mLastTouchX = x;
        mLastTouchY = y;
        mActivePointerId = ev.getPointerId(0);

        break;
    }

    case MotionEvent.ACTION_POINTER_DOWN: {
        // A non-primary pointer has gone down.

        touchState = PINCH;

        // Get the distance when the second pointer touch
        distx = ev.getX(0) - ev.getX(1);
        disty = ev.getY(0) - ev.getY(1);
        dist0 = FloatMath.sqrt(distx * distx + disty * disty);

        break;
    }

    case MotionEvent.ACTION_MOVE: {

        if (touchState == PINCH) {
            // Get the current distance
            distx = ev.getX(0) - ev.getX(1);
            disty = ev.getY(0) - ev.getY(1);
            distCurrent = FloatMath.sqrt(distx * distx + disty * disty);

            drawMatrix();
        }
        final int pointerIndex = ev.findPointerIndex(mActivePointerId);
        final float x = ev.getX(pointerIndex);
        final float y = ev.getY(pointerIndex);

        // Only move if the ScaleGestureDetector isn't processing a
        // gesture.
        if (!mScaleDetector.isInProgress()) {
            final float dx = x - mLastTouchX;
            final float dy = y - mLastTouchY;

            mPosX += dx;
            mPosY += dy;

            invalidate();
        }

        mLastTouchX = x;
        mLastTouchY = y;

        break;
    }

    case MotionEvent.ACTION_UP: {
        mActivePointerId = INVALID_POINTER_ID;
        touchState = IDLE;

        break;
    }

    case MotionEvent.ACTION_CANCEL: {
        mActivePointerId = INVALID_POINTER_ID;

        break;
    }

    case MotionEvent.ACTION_POINTER_UP: {
        final int pointerIndex = (ev.getAction() &amp; MotionEvent.ACTION_POINTER_INDEX_MASK) &gt;&gt; MotionEvent.ACTION_POINTER_INDEX_SHIFT;
        final int pointerId = ev.getPointerId(pointerIndex);
        if (pointerId == mActivePointerId) {
            // This was our active pointer going up. Choose a new
            // active pointer and adjust accordingly.
            final int newPointerIndex = pointerIndex == 0 ? 1 : 0;
            mLastTouchX = ev.getX(newPointerIndex);
            mLastTouchY = ev.getY(newPointerIndex);

            mActivePointerId = ev.getPointerId(newPointerIndex);
            touchState = TOUCH;

        }
        break;
    }
    }

    return true;
}

private class ScaleListener extends
        ScaleGestureDetector.SimpleOnScaleGestureListener {
    @Override
    public boolean onScale(ScaleGestureDetector detector) {
        mScaleFactor *= detector.getScaleFactor();

        // Don't let the object get too small or too large.
        mScaleFactor = Math.max(0.1f, Math.min(mScaleFactor, 10.0f));

        invalidate();
        return true;
    }

}

public class MyGesturedetector extends SimpleOnGestureListener implements
        OnDoubleTapListener {

    ShowCanvas canvas;
    Bitmap mainbitmap;

    public MyGesturedetector(ShowCanvas showCanvas) {
        // TODO Auto-generated constructor stub
        canvas = showCanvas;

    }

    @Override
    public boolean onDoubleTap(MotionEvent e) {
        // TODO Auto-generated method stub

        System.out
                .println("DoubleTapEvent" + "ScaledBitmap" + ScaledBitmap);

        System.out.println("DoubleTapEvent" + "resizedBitmap"
                + resizedBitmap);

        overlaybitmap = combineImages(ScaledBitmap, resizedBitmap);

        System.out.println("OVERLAYBITMAP" + overlaybitmap);

        truevalue = true;

        invalidate();
        return super.onDoubleTap(e);

    }

}
</code></pre>

<p>** Here I Combine Two Bitmap One Over Another **</p>

<pre><code>      public Bitmap combineImages(Bitmap ScaledBitmap, Bitmap bit) {

    int X = bit.getWidth();
    int Y = bit.getHeight();

    Scaled_X = ScaledBitmap.getWidth();
    scaled_Y = ScaledBitmap.getHeight();

    System.out.println("InSidecombineImage ScaledImage" + ScaledBitmap);
    System.out.println("InSidecombineImage bit" + bit);

    overlaybitmap = Bitmap.createBitmap(ScaledBitmap.getWidth(),
            ScaledBitmap.getHeight(), ScaledBitmap.getConfig());
    Canvas canvas = new Canvas(overlaybitmap);

    matrix = new Matrix();
    matrix.setRotate(180, bit.getWidth(), bit.getHeight());

    canvas.drawBitmap(ScaledBitmap, matrix, new Paint());
    canvas.drawBitmap(bit, mPosX, mPosY, new Paint());

    return overlaybitmap;
}

@Override
protected void onDraw(Canvas canvas) {
    // TODO Auto-generated method stub
    Paint mpaint = new Paint();

    if (!truevalue) {

        canvas.save();
        canvas.drawBitmap(ScaledBitmap, 0, 0, mpaint);
        Log.d("DEBUG", "X: " + mPosX + " Y: " + mPosY);

        canvas.translate(mPosX, mPosY);

        canvas.scale(mScaleFactor, mScaleFactor);

        mImage.draw(canvas);
        canvas.restore();

    } else {
</code></pre>

<p>*<em>Here My problem Occur At First Time My Bimtpa  Image move Over Another Bitmap Image but When I Go Back And Select Another Image Than Error Called "Canvas.ThrowIfRecycled" *</em></p>

<pre><code>             canvas.drawBitmap(overlaybitmap, 0, 0, mpaint);

     }

      }

           }
</code></pre>
