same physical display size

danoptic

Member
Licensed User
Longtime User
I need to have an image with the exact physical display size on every phone or tablet.
Do you have an example to do that?

Dan
 

wl

Well-Known Member
Licensed User
Longtime User
Have a look at the excellent manual written by klaus and erel (5. Screen and sizes on p.71 of version 1.6 of the beginners manual)

I guess you will need to do some calculations and resizing based on these values.

Wim
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
The following code uses reflection to extract the exact horizontal and vertical dpi (dots per inch) values:
B4X:
Sub Activity_Create (FirstTime As Boolean)
   Dim r As Reflector
   r.Target = r.GetContext
   r.Target = r.RunMethod("getResources")
   r.Target = r.RunMethod("getDisplayMetrics")
   Log(r.GetField("xdpi"))
   Log(r.GetField("ydpi"))
End Sub
 
Upvote 0

Kapelis

Member
Licensed User
Longtime User
The following code uses reflection to extract the exact horizontal and vertical dpi (dots per inch) values:
B4X:
Sub Activity_Create (FirstTime As Boolean)
   Dim r As Reflector
   r.Target = r.GetContext
   r.Target = r.RunMethod("getResources")
   r.Target = r.RunMethod("getDisplayMetrics")
   Log(r.GetField("xdpi"))
   Log(r.GetField("ydpi"))
End Sub
Thank you very much Erel, I solved the problem :)
 
Upvote 0

Kapelis

Member
Licensed User
Longtime User
Have a look at the excellent manual written by klaus and erel (5. Screen and sizes on p.71 of version 1.6 of the beginners manual)

I guess you will need to do some calculations and resizing based on these values.

Wim
Thank you very much, I solved the problem with your and Erel's advice.
 
Upvote 0
Top