@Override
    public boolean renderFrame(int frameNumber, Bitmap targetBitmap) {
      Canvas canvas = new Canvas(targetBitmap);
      canvas.drawColor(mColors[frameNumber]);
      int textSize = targetBitmap.getWidth() / 4;

      mTextPaint.setTextSize(textSize);

      String text = "F " + frameNumber;

      float textWidth = mTextPaint.measureText(text, 0, text.length());

      canvas.drawText(
          text,
          (targetBitmap.getWidth() - textWidth) / 2,
          (targetBitmap.getHeight() + textSize) / 2,
          mTextPaint);
      return true;
    }
Renderer that draws a color and the frame number on top
samples/animation2/src/main/java/com/facebook/samples/animation2/bitmap/ExampleBitmapAnimationFactory.java