Java tutorial
//package com.java2s; import android.graphics.Paint; import android.graphics.Rect; public class Main { public static Rect measureText(Paint paint, String str) { Rect rect = new Rect(); paint.getTextBounds(str, 0, str.length(), rect); return rect; } }