Java tutorial
//package com.java2s; //License from project: Open Source License import android.graphics.Rect; import android.graphics.RectF; public class Main { public static Rect rect(final RectF rect) { return new Rect((int) rect.left, (int) rect.top, (int) rect.right, (int) rect.bottom); } public static Rect rect(final float left, final float top, final float right, final float bottom) { return new Rect((int) left, (int) top, (int) right, (int) bottom); } }