So I used this code to calculate screen size, but it returns wrong results.
It returns a screen size of 4'33"
but in reality the screen is 5'.0"
So the value 4.33" corresponds to what? Current activity size?
DisplayMetrics metrics = new DisplayMetrics(); getWindowManager().getDefaultDisplay().getMetrics(metrics);
float height=metrics.heightPixels/metrics.xdpi;
float width=metrics.widthPixels/metrics.ydpi;
And then, the view
"The screen size is:"+(float)Math.sqrt(height*height+width*width) +"\n"