Example usage for android.content Context getResources

List of usage examples for android.content Context getResources

Introduction

In this page you can find the example usage for android.content Context getResources.

Prototype

public abstract Resources getResources();

Source Link

Document

Returns a Resources instance for the application's package.

Usage

From source file:Main.java

public static float getFloatValue(Context context, int id) {
    return context.getResources().getDimension(id);
}

From source file:Main.java

public static String[] getArrayValue(Context context, int id) {
    return context.getResources().getStringArray(id);
}

From source file:Main.java

private static String[] getStringArray(Context context, int id) {
    return context.getResources().getStringArray(id);
}

From source file:Main.java

public static float getDisplayMetricsDensity(Context context) {
    density = context.getResources().getDisplayMetrics().density;

    return density;
}

From source file:Main.java

public static int getWindowWidth(Context context) {
    return context.getResources().getDisplayMetrics().widthPixels;
}

From source file:Main.java

public static int getWindowHeight(Context context) {
    return context.getResources().getDisplayMetrics().heightPixels;
}

From source file:Main.java

public static final float dpToPx(Context context, int px) {
    return context.getResources().getDisplayMetrics().density * px;
}

From source file:Main.java

public static String[] getStringArrayFromXML(Context context, int id) {
    return context.getResources().getStringArray(id);
}

From source file:Main.java

public static int getScreenW(Context c) {
    return c.getResources().getDisplayMetrics().widthPixels;
}

From source file:Main.java

public static String getString(Context context, int id) {
    return context.getResources().getString(id);

}