Example usage for android.util DisplayMetrics DisplayMetrics

List of usage examples for android.util DisplayMetrics DisplayMetrics

Introduction

In this page you can find the example usage for android.util DisplayMetrics DisplayMetrics.

Prototype

public DisplayMetrics() 

Source Link

Usage

From source file:Main.java

public static DisplayMetrics constructMetrics() {
    DisplayMetrics h = new DisplayMetrics();
    h.density = 1.5f;
    h.widthPixels = 480;

    return h;
}

From source file:Main.java

public static int getScreenWidth(Context context) {
    new DisplayMetrics();
    return context.getResources().getDisplayMetrics().widthPixels;
}

From source file:Main.java

public static int getScreenWidth(Context context) {
    new DisplayMetrics();
    return context.getApplicationContext().getResources().getDisplayMetrics().widthPixels;
}

From source file:Main.java

public static int getScreenHeight(Context context) {
    new DisplayMetrics();
    return context.getApplicationContext().getResources().getDisplayMetrics().heightPixels;
}

From source file:Main.java

public static float getDensity(Activity act) {
    DisplayMetrics dm = new DisplayMetrics();
    act.getWindowManager().getDefaultDisplay().getMetrics(dm);
    return dm.density;
}

From source file:Main.java

public static int getHeight(Activity context) {
    DisplayMetrics dm = new DisplayMetrics();
    context.getWindowManager().getDefaultDisplay().getMetrics(dm);
    int screenHeigt = dm.heightPixels;
    return screenHeigt;
}

From source file:Main.java

public static int getScreenWidth(Activity act) {
    DisplayMetrics dm = new DisplayMetrics();
    act.getWindowManager().getDefaultDisplay().getMetrics(dm);
    return dm.widthPixels;
}

From source file:Main.java

public static int getWidth(Activity context) {
    DisplayMetrics dm = new DisplayMetrics();
    context.getWindowManager().getDefaultDisplay().getMetrics(dm);
    int screenWidth = dm.widthPixels;
    return screenWidth;
}

From source file:Main.java

public static int GetScreenHeight(Activity act) {
    DisplayMetrics dm = new DisplayMetrics();
    act.getWindowManager().getDefaultDisplay().getMetrics(dm);
    return dm.heightPixels;
}

From source file:Main.java

public static int getScreenHeight(Activity act) {
    DisplayMetrics dm = new DisplayMetrics();
    act.getWindowManager().getDefaultDisplay().getMetrics(dm);
    return dm.heightPixels;
}