Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
//License from project: Apache License 

import android.content.Context;

import android.support.annotation.DimenRes;

import android.util.TypedValue;

public class Main {
    /**
     * gets float from resource values
     *
     * @param context context of calling activity
     * @param dimen   resource id
     * @return float
     */
    public static float getFloat(Context context, @DimenRes int dimen) {
        TypedValue outValue = new TypedValue();
        context.getResources().getValue(dimen, outValue, true);
        return outValue.getFloat();
    }
}