Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
//License from project: Open Source License 

import android.content.Context;

import android.util.DisplayMetrics;
import android.util.Log;

public class Main {
    private static final String TAG = "AppUtils";

    public static boolean isRunningOn2xOrGreaterScreen(Context context) {
        if (context == null) {
            return false;
        }
        int density = context.getResources().getDisplayMetrics().densityDpi;
        boolean result = density >= DisplayMetrics.DENSITY_HIGH;
        Log.d(TAG, String.format("Device density is %d, and result of @2x check is %b", density, result));
        return result;
    }
}