Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
//License from project: Open Source License 

import android.graphics.Paint;
import android.graphics.Rect;

public class Main {
    public static Rect getTextBounds(float textSize, String text) {
        Rect bounds = new Rect();
        Paint paint = new Paint(Paint.ANTI_ALIAS_FLAG);
        paint.setTextSize(textSize);

        paint.getTextBounds(text, 0, text.length(), bounds);

        bounds.height();
        return bounds;
    }
}