title: Draw text inside android circle
body: <pre><code>public static Bitmap drawCircle(int width,int height, int borderWidth) {
      Bitmap canvasBitmap = Bitmap.createBitmap( 350, 350, Bitmap.Config.ARGB_8888);
      BitmapShader shader = new BitmapShader(canvasBitmap, TileMode.CLAMP, TileMode.CLAMP);
      Paint paint = new Paint();
      paint.setAntiAlias(true);
      paint.setShader(shader);
      paint.setShader(null);
      paint.setStyle(Paint.Style.STROKE);
      paint.setColor(Color.WHITE);
      paint.setStrokeWidth(borderWidth);
  
      Paint paint1 = new Paint();
      paint1.setAntiAlias(true);
      paint1.setShader(shader);
      paint1.setShader(null);
      paint1.setStyle(Paint.Style.STROKE);
      paint1.setColor(Color.WHITE);
      paint1.setStrokeWidth(borderWidth); 
      Canvas canvas = new Canvas(canvasBitmap);
      float radius = width &gt; height ? ((float) height) / 2f : ((float) width) / 2f;
      //canvas.drawCircle(width / 2, height / 2, radius - borderWidth / 2, paint);
      final RectF rect = new RectF();
      rect.set(100, 100, 300, 300); 
      canvas.drawArc(rect, 270, 90, false, paint1);
      canvas.drawText("25%", 100, 100, 100, 100, paint1);
      return canvasBitmap;
  }
  </code></pre>
  
  <p>How can I draw a text inside the arc? I get <code>IndexOutOfBoundException</code> in drawtext...
  What parameter shall i pass? how can i get it inside the arc?</p>