I'd like to create a Bitmap from a String with a given text size and set it as source of an ImageView.
The ImageView in it's layout xml:
<ImageView
    android:id="@+id/myImageView"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:scaleType="fitXY"/>
Setting the Bitmap as src of the ImageView:
myImageView.setImageBitmap(getBitmapFromString("StringToDraw", 30));
My getBitmapFromString method:
private Bitmap getBitmapFromString(String string, float textSize) {
    Bitmap bitmap = Bitmap.createBitmap(200, 200, Bitmap.Config.ARGB_8888);
    Canvas canvas = new Canvas(bitmap);
    Paint paint = new Paint();
    paint.setAntiAlias(true);
    paint.setSubpixelText(true);
    paint.setStyle(Paint.Style.FILL);
    paint.setColor(Color.WHITE);
    paint.setTextSize(textSize);
    paint.setTextAlign(Paint.Align.LEFT);
    canvas.drawText(string, 0, 100, paint);
    return bitmap;
}
How can i calculate the proper size for the Bitmap (from the given text size and String length) and how can i make it to fit the ImageView properly?