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 getSceneOrientation(Context context) {
    return context.getResources().getConfiguration().orientation;
}

From source file:Main.java

public static boolean isLandscape(Context context) {
    return context.getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE;
}

From source file:Main.java

public static String getMyCountryCode(Context context) {
    return context.getResources().getConfiguration().locale.getLanguage() + "_"
            + context.getResources().getConfiguration().locale.getCountry();
}

From source file:Main.java

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

From source file:Main.java

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

From source file:Main.java

public static float getDimension(int resourceID, Context mContext) {
    return mContext.getResources().getDimension(resourceID);
}

From source file:Main.java

public static boolean isScreenOriatationPortrait(Context context) {
    return context.getResources().getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT;
}

From source file:Main.java

public static String getResourceString(Context c, int id) {
    return c.getResources().getString(id);
}

From source file:Main.java

public static String getScreenWidth(Context context) {
    int i = context.getResources().getDisplayMetrics().widthPixels;
    return (new StringBuilder()).append(i).toString();
}

From source file:Main.java

public static Locale getLocale(Context context) {
    return context.getResources().getConfiguration().locale;
}