Android examples for App:Resource
get Raw Resource Size
//package com.java2s; import android.content.Context; import android.content.res.Resources; import android.util.TypedValue; public class Main { /**/*from w ww. j a va 2s . com*/ * @param context * @param unit * The unit to convert from. {@link TypedValue#TYPE_DIMENSION}. * @param value * value The value to apply the unit to. * @return The complex floating point value multiplied by the appropriate * metrics depending on its unit. */ public static int getRawSize(Context context, int unit, float value) { Resources resources; if (context == null) resources = Resources.getSystem(); else resources = context.getResources(); return (int) TypedValue.applyDimension(unit, value, resources.getDisplayMetrics()); } }