Java tutorial
//package com.java2s; //License from project: Open Source License import android.content.Context; import android.util.DisplayMetrics; import android.util.TypedValue; public class Main { public static float getRawSize(Context context, int unit, float size) { return TypedValue.applyDimension(unit, size, context.getResources().getDisplayMetrics()); } public static DisplayMetrics getDisplayMetrics(Context context) { return context.getResources().getDisplayMetrics(); } }