List of usage examples for android.content Context getResources
public abstract Resources getResources();
From source file:Main.java
public static String getStringFromResource(Context c, int resid) { return c.getResources().getString(resid); }
From source file:Main.java
public static int dp(float value, Context c) { density = c.getResources().getDisplayMetrics().density; return (int) Math.ceil(density * value); }
From source file:Main.java
public static int getColorFromResources(Context context, int res) { return context.getResources().getColor(res); }
From source file:Main.java
public static float dpFromPx(Context c, float px) { return px / c.getResources().getDisplayMetrics().density; }
From source file:Main.java
public static float pxFromDp(Context c, float dp) { return dp * c.getResources().getDisplayMetrics().density; }
From source file:Main.java
public static int dpToPx(int dp, Context context) { float scale = context.getResources().getDisplayMetrics().density; return (int) (dp * scale + 0.5f); }
From source file:Main.java
public static float pxFromDp(Context context, float f) { return context.getResources().getDisplayMetrics().density * f; }
From source file:Main.java
public static String frmRes(Context context, int id) { return context.getResources().getString(id); }
From source file:Main.java
public static String getStrValue(Context context, int id) { return context.getResources().getString(id); }
From source file:Main.java
public static int getColor(Context context, int id) { return context.getResources().getColor(id); }