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 int getScreenHeightPixels(Context context) {
    return context.getResources().getDisplayMetrics().heightPixels;
}

From source file:Main.java

public static String getLanguage(Context context) {
    return context.getResources().getConfiguration().locale.getLanguage();
}

From source file:Main.java

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

From source file:Main.java

public static String getLocaleText(Context context) {
    return context.getResources().getConfiguration().locale.getLanguage();
}

From source file:Main.java

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

From source file:Main.java

public static float getDensity(Context aContext) {
    return aContext.getResources().getDisplayMetrics().density;
}

From source file:Main.java

public static boolean hasNavBar(Context ctx) {
    int id = ctx.getResources().getIdentifier("config_showNavigationBar", "bool", "android");
    return id > 0 && ctx.getResources().getBoolean(id);
}

From source file:Main.java

public static float getPixelDensity(Context context) {
    return context.getResources().getDisplayMetrics().density;
}

From source file:Main.java

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

From source file:Main.java

public static float getScale(Context context) {
    return context.getResources().getDisplayMetrics().density;
}