Android examples for Phone:Screen
calculate Screen Size
//package com.java2s; import android.content.Context; import android.util.DisplayMetrics; public class Main { public static double calculateScreenSize(DisplayMetrics outMetrics) { double x = Math.pow(outMetrics.widthPixels / outMetrics.xdpi, 2); double y = Math.pow(outMetrics.heightPixels / outMetrics.ydpi, 2); double screenInches = Math.sqrt(x + y); return screenInches; }/* www. j a v a 2 s . com*/ public static double calculateScreenSize(Context context) { DisplayMetrics outMetrics = context.getResources() .getDisplayMetrics(); return calculateScreenSize(outMetrics); } }