Java tutorial
//package com.java2s; import android.content.Context; public class Main { public static int px2sp(Context paramContext, float paramFloat) { float f = paramContext.getResources().getDisplayMetrics().scaledDensity; return (int) (paramFloat / f + 0.5F); } }