Hi everyone!
My script to detect screen size
ISSUE:
Based on this script (I don't know if I'm doing it right) I saw something that I can't figure out. I have a Motorola G8 PLUS and a G9 PLUS. As you can see the one on the left (MOTO G9 PLUS) is taller than the one on the right (MOTO G8 PLUS) BUT THIS SCRIPT TELLS ME THAT THE HEIGHT OF THE MOTO G9 IS LOWER THAN THE MOTO G8 HOW CAN THIS POSSIBLE?.
I know that ApproximateScreenSize is not exact but I think there is a mistake here. Maybe I have a bad concept of resolutions and sizes.
QUESTION
I have a project that if I run it on these phones everything adapts moderately well but if I run it on my other phone a SAMSUNG J2 CORE which is smaller the BXTables do not look good as well as the buttons and labels and their font I must change them.
Now my question is there any way for an app to detect these sizes and change what should be changed in the components (BXTables, Spinners, labels etc.) in the Main or should I do it Activity by activity according to the device?
I leave the sizes and images that according to this script has detected. Thanks to all in advance
SAMSUNG J2 CORE
SCREEN SIZE 4'
HEIGHT 888
WIDTH 540
SCALE 1.5
MOTO G8 PLUS
SCREEN SIZE 5'
HEIGHT 2081
WIDTH 1080
SCALE 2
---------------------------
MOTO G9 PLUS
SCREEN SIZE '5
HEIGHT 1473
WIDTH 720
SCALE 1
----------------------
BLUESTACK CONFIGURED AT 720 X 1280 240DPI
SCREEN SIZE '6
HEIGHT 1280
WIDTH 720
SCALE 1
---------------------------
PIXEL 3 GOOGLE
SCREEN SIZE '5
HEIGHT 2028
WIDTH 1080
SCALE 2
My script to detect screen size
B4X:
Sub Activity_Create(FirstTime As Boolean)
Activity.LoadLayout("Layout")
Dim SCALE As Long
Dim SIZE As Long
Dim HEIGHT As Long
Dim WIDTH As Long
SCALE= GetDeviceLayoutValues.Scale
SIZE = GetDeviceLayoutValues.ApproximateScreenSize
HEIGHT= GetDeviceLayoutValues.Height
WIDTH= GetDeviceLayoutValues.Width
MsgboxAsync("LA MEDIDA DE TU PANTALLA ES: " & SIZE & " ALTURA: " & HEIGHT & " ANCHO: " & WIDTH & " ESCALA: "& SCALE, "INFO")
End sub
ISSUE:
Based on this script (I don't know if I'm doing it right) I saw something that I can't figure out. I have a Motorola G8 PLUS and a G9 PLUS. As you can see the one on the left (MOTO G9 PLUS) is taller than the one on the right (MOTO G8 PLUS) BUT THIS SCRIPT TELLS ME THAT THE HEIGHT OF THE MOTO G9 IS LOWER THAN THE MOTO G8 HOW CAN THIS POSSIBLE?.
I know that ApproximateScreenSize is not exact but I think there is a mistake here. Maybe I have a bad concept of resolutions and sizes.
QUESTION
I have a project that if I run it on these phones everything adapts moderately well but if I run it on my other phone a SAMSUNG J2 CORE which is smaller the BXTables do not look good as well as the buttons and labels and their font I must change them.
Now my question is there any way for an app to detect these sizes and change what should be changed in the components (BXTables, Spinners, labels etc.) in the Main or should I do it Activity by activity according to the device?
I leave the sizes and images that according to this script has detected. Thanks to all in advance
SAMSUNG J2 CORE
SCREEN SIZE 4'
HEIGHT 888
WIDTH 540
SCALE 1.5
MOTO G8 PLUS
SCREEN SIZE 5'
HEIGHT 2081
WIDTH 1080
SCALE 2
---------------------------
MOTO G9 PLUS
SCREEN SIZE '5
HEIGHT 1473
WIDTH 720
SCALE 1
----------------------
BLUESTACK CONFIGURED AT 720 X 1280 240DPI
SCREEN SIZE '6
HEIGHT 1280
WIDTH 720
SCALE 1
---------------------------
PIXEL 3 GOOGLE
SCREEN SIZE '5
HEIGHT 2028
WIDTH 1080
SCALE 2
Attachments
Last edited: