Java tutorial
//package com.java2s; import android.content.Context; import android.util.TypedValue; public class Main { public static float dimenToPixels(Context context, int complexUnit, float units) { float pixels = TypedValue.applyDimension(complexUnit, units, context.getResources().getDisplayMetrics()); return pixels; } }