title: Draw From Old Canvas - Android
body: <p>I'm making an App that needs to be able to draw new graphics on top of the last set.</p>
  
  <p>This is my current onDraw() method - </p>
  
  <pre><code>protected void onDraw(Canvas canvas) {
  
      canvas.drawColor(Color.WHITE);
  
      if(points.size() &gt; 0) {
          //do some stuff here - this is all working ok
          canvas.drawLine(p1.x, p1.y, p2.x, p2.y, linePaint);
      }   
  }
  </code></pre>
  
  <p>Basically, I need to draw the new graphics as a layer on top of the last, so what I'm looking for is a way to carry the image of the last canvas to the current.</p>
  
  <p>I have tried to figure it out myself using the canvas.setBitmap() method but it acts very funny.</p>
  
  <p>Any help appreciated :)</p>
  
  <p>P.S if it's needed, the the class extends <code>SurfaceView</code> and implements <code>SurfaceHolder.Callback</code></p>
  
  <p>Edit: This is what I have tried in the onDraw() method but it just force closes</p>
  
  <pre><code>if(bitmap != null) {
          canvas.drawBitmap(bitmap, 0, 0, paint);
          canvas.setBitmap(bitmap);  
      }
  </code></pre>