Example usage for android.util DisplayMetrics DENSITY_360

List of usage examples for android.util DisplayMetrics DENSITY_360

Introduction

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

Prototype

int DENSITY_360

To view the source code for android.util DisplayMetrics DENSITY_360.

Click Source Link

Document

Intermediate density for screens that sit somewhere between #DENSITY_XHIGH (320 dpi) and #DENSITY_XXHIGH (480 dpi).

Usage

From source file:Main.java

/**
 * The screen density expressed as dots-per-inch.
 * @param density_dpi "densityDpi"/*from   w w  w .j a  v  a 2s.c  om*/
 */
public static String getDensityDPIStr(int density_dpi) {
    switch (density_dpi) {
    case DisplayMetrics.DENSITY_LOW://120
        return "DENSITY_LOW";
    case DisplayMetrics.DENSITY_MEDIUM://160
        return "DENSITY_MEDIUM/DENSITY_DEFAULT";
    //case DisplayMetrics.DENSITY_DEFAULT://160
    //    return "DENSITY_DEFAULT";
    case DisplayMetrics.DENSITY_TV://213
        return "DENSITY_TV";
    case DisplayMetrics.DENSITY_HIGH://240
        return "DENSITY_HIGH";
    case DisplayMetrics.DENSITY_280://280
        return "DENSITY_280";
    case DisplayMetrics.DENSITY_XHIGH://320
        return "DENSITY_XHIGH";
    case DisplayMetrics.DENSITY_360://360
        return "DENSITY_360";
    case DisplayMetrics.DENSITY_400://400
        return "DENSITY_400";
    case DisplayMetrics.DENSITY_420://420
        return "DENSITY_420";
    case DisplayMetrics.DENSITY_XXHIGH://480
        return "DENSITY_XXHDPI";
    case DisplayMetrics.DENSITY_560://560
        return "DENSITY_560";
    case DisplayMetrics.DENSITY_XXXHIGH://640
        return "DENSITY_XXXHDPI";
    default:
        return UNKNOWN;
    }
}

From source file:ly.count.android.sdk.DeviceInfo.java

/**
 * Maps the current display density to a string constant.
 * @param context context to use to retrieve the current display metrics
 * @return a string constant representing the current display density, or the
 *         empty string if the density is unknown
 *//*from  w  ww. j  a v  a2s.c o m*/
static String getDensity(final Context context) {
    String densityStr = "";
    final int density = context.getResources().getDisplayMetrics().densityDpi;
    switch (density) {
    case DisplayMetrics.DENSITY_LOW:
        densityStr = "LDPI";
        break;
    case DisplayMetrics.DENSITY_MEDIUM:
        densityStr = "MDPI";
        break;
    case DisplayMetrics.DENSITY_TV:
        densityStr = "TVDPI";
        break;
    case DisplayMetrics.DENSITY_HIGH:
        densityStr = "HDPI";
        break;
    //todo uncomment in android sdk 25
    //case DisplayMetrics.DENSITY_260:
    //    densityStr = "XHDPI";
    //    break;
    case DisplayMetrics.DENSITY_280:
        densityStr = "XHDPI";
        break;
    //todo uncomment in android sdk 25
    //case DisplayMetrics.DENSITY_300:
    //    densityStr = "XHDPI";
    //    break;
    case DisplayMetrics.DENSITY_XHIGH:
        densityStr = "XHDPI";
        break;
    //todo uncomment in android sdk 25
    //case DisplayMetrics.DENSITY_340:
    //    densityStr = "XXHDPI";
    //    break;
    case DisplayMetrics.DENSITY_360:
        densityStr = "XXHDPI";
        break;
    case DisplayMetrics.DENSITY_400:
        densityStr = "XXHDPI";
        break;
    case DisplayMetrics.DENSITY_420:
        densityStr = "XXHDPI";
        break;
    case DisplayMetrics.DENSITY_XXHIGH:
        densityStr = "XXHDPI";
        break;
    case DisplayMetrics.DENSITY_560:
        densityStr = "XXXHDPI";
        break;
    case DisplayMetrics.DENSITY_XXXHIGH:
        densityStr = "XXXHDPI";
        break;
    default:
        densityStr = "other";
        break;
    }
    return densityStr;
}