Android Question Density is wrong

Facilauto Juan

Member
Licensed User
Longtime User
Hello there!

I have an app made in java that tells me the screen density. It tells me 0.93xx

If I check Density in basic 4 android, it tells me 0.75. So, that's my problem stablishing the font sizes according the screen size and density.

How can I fix this? How can I get the real screen density?

Thanks for the answers.
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
1. Basic4android returns the logical density as reported by your device. To simplify the lives of Android developers, the logical density is an approximation and is one of the following values: 0.75, 1, 1.33, 1.5 or 2.
You can use the code here to get the exact density: http://www.b4x.com/android/forum/threads/same-physical-display-size.14037/#post-79434

2. Font sizes are measured in a scale independent unit. This means that you shouldn't scale them yourself. They are already scaled.

The bottom line: don't use the exact values. Use designer script + anchors + AutoScaleAll.
 
Upvote 0
Top