Example usage for android.app Activity getResources

List of usage examples for android.app Activity getResources

Introduction

In this page you can find the example usage for android.app Activity getResources.

Prototype

@Override
    public Resources getResources() 

Source Link

Usage

From source file:Main.java

public static int getWindowWidthInPixel(Activity aty) {
    return aty.getResources().getDisplayMetrics().widthPixels;
}

From source file:Main.java

private static int getDisplayOrientation(Activity activity) {
    return activity.getResources().getConfiguration().orientation;
}

From source file:Main.java

public static boolean isXLargeDevice(Activity ctx) {
    int lt = (ctx.getResources().getConfiguration().screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK);
    return lt == Configuration.SCREENLAYOUT_SIZE_XLARGE;
}

From source file:Main.java

public static View findActionBarContainer(Activity activity) {
    int id = activity.getResources().getIdentifier("action_bar_container", "id", "android");
    return activity.findViewById(id);
}

From source file:Main.java

public static View findSplitActionBar(Activity activity) {
    int id = activity.getResources().getIdentifier("split_action_bar", "id", "android");
    return activity.findViewById(id);
}

From source file:Main.java

public static View findActionBarContainer(Activity activity) {
    int id = activity.getResources().getIdentifier("action_bar_container", "id", activity.getPackageName());
    return activity.findViewById(id);
}

From source file:Main.java

public static DisplayMetrics getDisplayInfo(Activity paramActivity) {
    return paramActivity.getResources().getDisplayMetrics();
}

From source file:Main.java

public static float getDimenResource(Activity activity, int dimenId) {
    return activity.getResources().getDimension(dimenId);
}

From source file:Main.java

public static String getStringResource(Activity activity, int stringId) {
    return activity.getResources().getString(stringId);
}

From source file:Main.java

/**
 * returns the string resource provided id.
 * @param activity - Current Activity reference
 * @param id - string resource id/*from   w ww .  j a v  a  2  s  . c o  m*/
 * @return
 */
public static String getString(Activity activity, int id) {
    return activity.getResources().getString(id);
}