0

I am working on an eye testing app for android tv box. I want to display the same size of font or image on every size of tv.

I try using ppi but it does not work.in in and mm is not same in all devices so how i find actual size of inch or mm in pixel in android

DisplayMetrics dm=new DisplayMetrics();
        getWindowManager().getDefaultDisplay().getMetrics(dm);
        double x=Math.pow(dm.widthPixels/dm.xdpi,2);
        double y=Math.pow(dm.heightPixels/dm.ydpi,2);
        double screeninches=Math.sqrt(x+y);
        double ppi=Math.sqrt(Math.pow(dm.widthPixels,2)+Math.pow(dm.heightPixels,2))/screeninches;

For Example, 10 cm font size appears the same on 32-inch display and 40-inch display

0 Answers0