title: Drawing multiple paths in android
body: <p>I am drawing closed paths in android canvas using finger movement. Here is my code for that</p>
  
  <pre><code>switch (event.getAction())
              {
                  case MotionEvent.ACTION_DOWN:
                      startPoint = new PointF(event.getX(), event.getY());
                      endPoint = new PointF();
                      hotSpot = new HotSpots();
                      endPoint.x = event.getX();
                      endPoint.y = event.getY();
                      wallpath = new Path();
                      wallpath.moveTo(endPoint.x,endPoint.y);
                      break;
                  case MotionEvent.ACTION_MOVE:
                      PointF point = new PointF(event.getX(),event.getY());
                      endPoint.x = event.getX();
                      endPoint.y = event.getY();
                  invalidate();
                      break;
                  case MotionEvent.ACTION_UP:
  
                      endPoint.x = startPoint.x;//event.getX();
                       isFinished = true;                    
                      break;
                  default:
                      break;
              }
  
      @Override
      protected void onDraw(Canvas canvas)
      {
          wallpath.lineTo(endPoint.x, endPoint.y);
              canvas.drawPath(wallpath, paint);
  
         if(isFinished)
          {
              wallpath.lineTo(endPoint.x, endPoint.y);
              canvas.drawPath(wallpath, paint);
          }
      }
  </code></pre>
  
  <p>On every new touch I am creating a new path. But when a new path is drawn the old path gets erased. How can I draw multiple paths on canvas with different fill colors to each path.</p>