//For DetectScreenSize method to work properly SetDisplayMetrics method must be first called public static CustomSize DetectScreenSize () { if (cs == null) { DisplayMetrics metrics = displayMetrics; int width = metrics.WidthPixels;//ConvertPixelsToDp(metrics.WidthPixels); int height = metrics.HeightPixels;//ConvertPixelsToDp(metrics.HeightPixels); //cs = new CustomSize(720,1280); cs = new CustomSize(width,height); } return cs; //return new int[] { width, height }; }
//For DetectScreenSize method to work properly SetDisplayMetrics method must be first called public static CustomSize DetectScreenSize() { if (cs == null) { DisplayMetrics metrics = displayMetrics; int width = metrics.WidthPixels; //ConvertPixelsToDp(metrics.WidthPixels); int height = metrics.HeightPixels; //ConvertPixelsToDp(metrics.HeightPixels); //cs = new CustomSize(720,1280); cs = new CustomSize(width, height); } return(cs); //return new int[] { width, height }; }