title: Android: Drawing a basic circle outline to a RelativeLayout
body: <p>I have a RelativeLayout that I want to contain 4 concentric circles (a radar effect, if you will).  I'd like to be able to hide and display the RelativeLayout, so I'm wondering how exactly to use Canvas and Paint to draw a circle to the RelativeLayout.  If someone could explain the lifecycle of how it works, that would be very helpful.  Right now I've got:</p>
  
  <pre><code>setContentView(R.layout.applayout);
  myRelLayout = (RelativeLayout) findViewById(R.id.RLRadar);
  Canvas canvas = new Canvas();
  Paint circlePaint = new Paint(Paint.ANTI_ALIAS_FLAG);
  circlePaint.setColor(0xFF000000);
  circlePaint.setStyle(Style.STROKE);
  canvas.drawCircle((float) centerX, (float) centerY, (float) (maxRadius / 4), circlePaint);
  </code></pre>
  
  <p>Am I on the right track?  Do I need to convert the canvas to some sort of ImageView and add that to the RelativeLayout?  Or am I completely off base here?</p>
  
  <p>Thanks for any help!</p>
  
  <p>Edit: Here's the working code.</p>
  
  <pre><code>// Add the radar to the RadarRL
  Picture picture = new Picture();
  Canvas canvas = picture.beginRecording(screenWidth, screenHeight);
  // Draw on the canvas
  Paint circlePaint = new Paint(Paint.ANTI_ALIAS_FLAG);
  circlePaint.setColor(0xFF000000);
  circlePaint.setStyle(Style.STROKE);
  circlePaint.setStrokeWidth((float) 5.0);
  canvas.drawCircle((float) centerX, (float) centerY, (float) (maxRadius / 4), circlePaint);
  canvas.drawCircle((float) centerX, (float) centerY, (float) ((3 * maxRadius) / 4), circlePaint);
  canvas.drawCircle((float) centerX, (float) centerY, (float) (maxRadius / 2), circlePaint);
  canvas.drawCircle((float) centerX, (float) centerY, (float) (maxRadius), circlePaint);      
  picture.endRecording();
  </code></pre>