Canvas cannot erase content
<p>Hi all for my application I need use two canvas, one is the foreground camera preview and the other is a background marker image. When I draw on the foreground camera preview canvas I need to draw on the background canvas also. But when I try to erase all the marking I am able to erase for foreground and not for background.My code looks like below.</p>

<pre><code>    static List&lt;Float&gt; x_points = new ArrayList&lt;Float&gt;(); 
    static List&lt;Float&gt; y_points = new ArrayList&lt;Float&gt;(); 
    volatile boolean touched = false;

    public void run() {
    mThreadRun = true;
    Log.i(TAG, "Starting processing thread");
    while (mThreadRun) {

        Bitmap bmp = null;
        Bitmap marker_bmp= null;
        Canvas marker_canvas = null;

        synchronized (this) {
            try {
                this.wait();

                bmp = processFrame(mFrame);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }


        if (bmp != null) {
            int WIDTH=bmp.getWidth();
            int HEIGHT=bmp.getHeight();

            if(marker_bmp==null){
                //marker_bmp=Bitmap.createBitmap(bmp);
                Bitmap.Config conf = Bitmap.Config.ARGB_8888; // see other conf types
                marker_bmp= Bitmap.createBitmap(WIDTH,HEIGHT, conf); // this creates a MUTABLE bitmap
                marker_canvas = new Canvas(marker_bmp);

                }

            Canvas canvas = mHolder.lockCanvas();
            if (canvas != null) {
                canvas.drawBitmap(bmp, (canvas.getWidth() - getFrameWidth()) / 2, (canvas.getHeight() - getFrameHeight()) / 2, null);



                if(touched){
                    mPaint.setStrokeWidth(5);
                    //mPaint.setColor(Color.GREEN);
                    for(int i=0;i&lt;x_points.size()-1;i++)
                    {
                        canvas.drawPoint(x_points.get(i), y_points.get(i), mPaint);

                        mPath.moveTo(x_points.get(i), y_points.get(i));
                        mPath.lineTo(x_points.get(i+1), y_points.get(i+1));
                        canvas.drawPath(mPath, mPaint);
                        marker_canvas.drawPath(mPath, mPaint);
                        mPath.reset();      

                        }



                   }



            marker_canvas=null;
            marker_bmp=null;

                mHolder.unlockCanvasAndPost(canvas);


            }
        }
    }
}


  @Override 
public boolean onTouchEvent(MotionEvent event) {



       x_points.add(event.getX());
       y_points.add(event.getY());

       int action = event.getAction();
       switch(action){
       case MotionEvent.ACTION_DOWN:
        touched = true;
        break;
       case MotionEvent.ACTION_MOVE:
        touched = true;
        break;
       case MotionEvent.ACTION_UP:
        touched = false;
        break;
       case MotionEvent.ACTION_CANCEL:
        touched = false;
        break;
       case MotionEvent.ACTION_OUTSIDE:
        touched = false;
        break;
       default:
       }
       return true; //processed
      }
</code></pre>

<p>Sorry for the long code....
My problem is when replace the line </p>

<pre><code>   canvas.drawBitmap(bmp, (canvas.getWidth() - getFrameWidth()) / 2, (canvas.getHeight() - getFrameHeight()) / 2, null);
</code></pre>

<p>with  </p>

<pre><code>    x_points.clear();                                       
    y_points.clear();                  
    marker_canvas.drawColor(Color.BLACK);
    marker_canvas.drawBitmap(marker_bmp, (canvas.getWidth() - getFrameWidth()) / 2, (canvas.getHeight() - getFrameHeight()) / 2, null);
</code></pre>

<p>it still showing the previously draws marking on my canvas. </p>

<p>Thanks in advance....</p>
