title: Redraw View Android
body: <p>I now have a View that is added programically after the onCreate (Depending on some other variables). Everything works as it should and it draws part of a circle. </p>
  
  <p>But my question is how do i redraw it later on ? I need to change the angle in the circle after some data is fetched. </p>
  
  <p>Code for the WindRose : </p>
  
  <pre><code>    public class WindRose extends View {
  
      public WindRose(Context context) {
          super(context);
  
  
      }
  
      @Override
  
      protected void onDraw(Canvas canvas) {
  
  
          super.onDraw(canvas);
          canvasTest = canvas;
  
  
          float height = (float) getHeight();
          float width = (float) getWidth();
  
          float radius;
  
          if (width &gt; height) {
              radius = height / 2;
  
          } else {
              radius = width / 2;
          }
  
          // radius = (height )/ 2;
  
  
          Path path = new Path();
          path.addCircle(width, height, radius, Path.Direction.CCW);
  
          // / 2
  
          Resources resources = getResources();
          int color = resources.getColor(R.color.green_back);
  
  
  
          paint.setColor(color);
          paint.setStrokeWidth(5);
  
          paint.setStyle(Paint.Style.FILL);
          float center_x, center_y;
          center_x = width / 2;
          center_y = height / 2;
  
  
  
          //Formulas :
          //SD = Start Degree
          //ED = End Degree
  
          //If cakepiece passes 0 (East)
          //SD, 360-(SD+ED)
  
          //Else :
          //SD, (ED-SD)
  
          oval.set(center_x - radius, center_y - radius, center_x + radius, center_y + radius);
  
          if (End &gt; Start) {
              canvas.drawArc(oval, Start, (End - Start), true, paint);
  
          } else if (End &lt; Start) {
              canvas.drawArc(oval, Start, ((360 - Start) + End), true, paint);
          }
  
  
      }
  
  
  }
  </code></pre>
  
  <p>If i update the <code>Start</code> and <code>End</code> variables nothing happens. i have also tried to call <code>invalidate</code> on the class but also there i dont get any redrawing. </p>
  
  <p>Invalidate that i've tried : </p>
  
  <pre><code>WindRose windrose = new WindRose(this);
  windrose.invalidate();
  </code></pre>
  
  <p>Was called from the main class which WindRose is part of.</p>
  
  <p>How should i do this correctly ?</p>