I have 2 questions about the "DPI" term.
1st, i googled this term, someone said that it means dots per inch. and we can use follow formula to canculate the screen dpi:
dpi = radical(screen_width_pixel^2+screen_height_pixel^2)/screen_inchs
Now, i have an android tv, i found that my tv resolution is 1920*1080, and the dpi is 240, the tv size is 50 inch. But if i use above formula to calculate the dpi, i will get the dpi value is 40, i don't know why? is above formula ppi formula?
2nd, i found that the dpi value is in the build.prop->ro.sf.lcd_density=240, i don't know why the manfacturer set this value, in other words, what is this value based on, why not setting 320 or other values? They user above farmula to get the value and set it?
Thanks a lot!
I have been researching answer to your question for last one day, and reached some conclusions -
1.
- PPI is pixels per inch, purely mathematical. i.e. - it calculate number of pixels per inch.
- DP - Device Independent Pixels AKA dots -> i.e. android system defines a virtual pixel so that it could compare devices with different pixel densities. You know baseline is 160 DPi (160 dots per inch), so any MDPI device has a virtual grid which contains 160 DP per inch, while a device which is HDPI has same grid but it will contain 240 DP per inch. (Note that number of pixels one dot/Device independent Pixel may contain varies, depending on the size of device.)
- here comes your answers-
a) DPi is system defined, all you can calculate is number of DP in one inch, which in your case sums up to - 1920*160/240 =1280 DPs in height, 1080*160/240 = 720 DPs in width), what you calculated is PPi.
b) manufacturer set it so that you could know how much you need to resize your image. Suppose an image which is of certain size in 160DPi, then to make this image look same size, you need to double the size of the image on 320DPi screen.
Note - I tried on my part to make you understand, if you find any problem understanding my answer, Please comment, would be happy to assist.
Reference # 1