Can I detect screen DPI?

rfresh

Well-Known Member
Licensed User
Longtime User
How can I detect the screen DPI? I'm currently fetching the screen's .Width and .Height properties via the Activity.Width, etc. Can I get the DPI too?

Thanks...
 

barx

Well-Known Member
Licensed User
Longtime User
Not sure if there is a direct call for dpi. But there is a 'density' keyword which is dpi / 160. so something like:

B4X:
Dim intDPI as int 

intDPI = density * 160

I don't think DPI's are ever NOT a int value, but you could declare it as a float to be sure.
 
Upvote 0
Top