Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
import android.content.Context;

import android.util.TypedValue;

public class Main {
    /**
     * sp2Px
     *
     * @param context context
     * @param sp      sp
     * @return float
     */
    public static float sp2Px(Context context, int sp) {
        return TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_SP, sp,
                context.getResources().getDisplayMetrics());
    }
}