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.content.res.TypedArray;

import android.support.annotation.AttrRes;

import android.support.annotation.StyleRes;

public class Main {
    public static float getDimension(Context context, @StyleRes int styleResId, @AttrRes int attr) {
        TypedArray typedArray = context.getTheme().obtainStyledAttributes(styleResId, new int[] { attr });
        float size = typedArray.getDimension(0, 0);
        typedArray.recycle();
        return size;
    }
}