title: Android: Star path will not fill
body: <p>I have a class that creates a Star using <code>Path</code> this code is as follows:</p>
  
  <pre><code>public Star(int x, int y, int size) {
      this.x = x;
      this.y = y;
      this.size = size;
      rotateSpeed = 1.5f;
  
      path = new Path();
      path.moveTo(x, y-size);
      for(int i = 1; i &lt; 11; i++) {
          double radius;
          if(i % 2 == 0)
              radius = size;
          else
              radius = size/2.2;
          double angleRad = Math.toRadians(360/10) * i;
          double cosY = y - (Math.cos(angleRad) * radius);
          double tanX = x + (Math.sin(angleRad) * radius);
          path.lineTo((int)tanX, (int)cosY);
          path.moveTo((int)tanX, (int)cosY);
      }
      path.setLastPoint(x, y-size);
  }
  </code></pre>
  
  <p>The problem is that it only draws an outline of it and won't actually fill it despite the fact that I explicitly state <code>paint.setStyle(Paint.Style.FILL);</code></p>
  
  <p>My drawing code is:</p>
  
  <pre><code>public void drawObject(Canvas canvas, boolean antialias) {
      Paint p = new Paint();
      p.setStyle(Paint.Style.FILL);
      p.setAntiAlias(antialias);
      p.setColor(color);
      canvas.drawPath(path, p);
  
      //Outline
      p.setStyle(Paint.Style.STROKE);
      p.setStrokeWidth(5);
      p.setColor(Color.BLACK);
      canvas.drawPath(path, p);
  }
  </code></pre>
  
  <p>I don't understand what I'm doing wrong. Why won't it fill?</p>