Java tutorial
//package com.java2s; //License from project: Open Source License import android.app.Activity; import android.util.DisplayMetrics; public class Main { private static DisplayMetrics dm; public static double getScreenSize(Activity activity) { if (dm == null) { dm = new DisplayMetrics(); } activity.getWindowManager().getDefaultDisplay().getMetrics(dm); double x = Math.pow(dm.widthPixels / dm.densityDpi, 2); double y = Math.pow(dm.heightPixels / dm.densityDpi, 2); return Math.sqrt(x + y); } }