List of usage examples for android.content Context getResources
public abstract Resources getResources();
From source file:Main.java
public static int getRowId(Context paramContext, String paramString) { return paramContext.getResources().getIdentifier(paramString, "row", paramContext.getPackageName()); }
From source file:Main.java
public static int getColorId(Context paramContext, String paramString) { return paramContext.getResources().getIdentifier(paramString, "color", paramContext.getPackageName()); }
From source file:Main.java
public static int dip2px(Context context, double d) { final float scale = context.getResources().getDisplayMetrics().density; return (int) (d * scale + 0.5f); }
From source file:Main.java
static public int getLayoutResource(Context ctx, String name) { return ctx.getResources().getIdentifier(name, "layout", ctx.getPackageName()); }
From source file:Main.java
static public int getIdResource(Context ctx, String name) { return ctx.getResources().getIdentifier(name, "id", ctx.getPackageName()); }
From source file:Main.java
public static int getColor(Context context, @ColorRes int resId) { return context.getResources().getColor(resId); }
From source file:Main.java
public static int getPixel(Context context, int pixel) { float density = context.getResources().getDisplayMetrics().density; int paddingDp = (int) (pixel * density); return paddingDp; }
From source file:Main.java
public static int getValuesId(Context paramContext, String paramString) { return paramContext.getResources().getIdentifier(paramString, "values", paramContext.getPackageName()); }
From source file:Main.java
public static final int getHeightInDp(Context context) { final float height = context.getResources().getDisplayMetrics().heightPixels; int heightInDp = px2dip(context, height); return heightInDp; }
From source file:Main.java
static public int getDrawable(Context ctx, String name) { return ctx.getResources().getIdentifier(name, "drawable", ctx.getPackageName()); }