cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
MrFVD
Paper Tape
Posts: 3
Registered: ‎12-02-2019
Location: US
Views: 163
Message 1 of 6

Wrong Screen size when reading using getRealMetrics

Hello,

 

maybe you can help me, I am using some code to getRealMetrics to have the screen size in all devices, this seems to be Ok and working in all devices that i am testing, but i have a different results in a Moto G7 Plus, i am using this code

 

DisplayMetrics realMetrics = new DisplayMetrics();
Display screen_display = activity.getWindowManager().getDefaultDisplay();
 screen_display.getRealMetrics(realMetrics);
screenSizeWidth = realMetrics.widthPixels / realMetrics.xdpi;
screenSizeHeight = realMetrics.heightPixels / realMetrics.ydpi;
screenSizeDpiHorz = realMetrics.xdpi;
screenSizeDpiVert = realMetrics.ydpi;
screenSizeDensDPI = realMetrics.densityDpi;
screenSizeDensRatio = realMetrics.density;

 

and i getting this result

 

https://drive.google.com/file/d/1x9tKqxBFzgK6leYkPtFYs1TBj7y_Rm0_/view?usp=sharing

 

sorry try to upload the two photos  inside the zip with no luck.

 

 

Thnkas in advance for check this.

 

 

 

Senior MotoAgent
Senior MotoAgent
Posts: 7,185
Registered: ‎03-05-2018
Location: US
Views: 129
Message 2 of 6

Re: Wrong Screen size when reading using getRealMetrics

Hi MrFVD,

 

We've looked at your attachments - thanks. But it's not clear what you are trying to do. What should you be seeing and what are you seeing? This is clearly not a typical use case. What are you seeing on other devices that are comparable? Also, try using the "Photos" to add pictures to your post. Thanks.

 

Best regards,
Rich
Motorola-Lenovo Support



Did someone help you today? Press the star on the left to thank them with a Kudo!
If you find a post helpful and it answers your question, please mark it as an "Accepted Solution"! This will help the rest of the Community with similar issues identify the verified solution and benefit from it.

MrFVD
Paper Tape
Posts: 3
Registered: ‎12-02-2019
Location: US
Views: 127
Message 3 of 6

Re: Wrong Screen size when reading using getRealMetrics

oh I try to use upload but it get stuck when pressing done and wait 10 min and nothing happens

this code is used inside a game maker runtime (clickteam) and seems to work in different devices, but fails when running in your moto g7 plus

so far we have tested in
- Acer Iconia One 7
- OnePlus 3T
- BlackBerry Priv
- Huawei Y7
- Galaxy S6
- Google Nexus 4
-Nexus 7 2nd gen
-Samsung note 3 neo
-Samsung core duo
-Samsung A50
-LG k20
-ZTE Blade MAX

in this device this code react and bring the correct screen size results, something that fails in moto G7 plus, the images are just a comparison results between two device teh Samsung a50 and teh moto g7 plus, see that in the case of Motorola teh size are bigger at it shoudl be, all using the formula proposed by Google Android, I have teh small apk that generate this results in case you want to test at your side they are made using Clickeam Android

Senior MotoAgent
Senior MotoAgent
Posts: 7,185
Registered: ‎03-05-2018
Location: US
Views: 94
Message 4 of 6

Re: Wrong Screen size when reading using getRealMetrics

Hi MrFVD,

 

Thanks for further explaining. This is interesting, though, I'm still not getting why you're checking this. Are you trying to develop some sort of games- are you a developer?

 

Best regards,
Rich
Motorola-Lenovo Support



Did someone help you today? Press the star on the left to thank them with a Kudo!
If you find a post helpful and it answers your question, please mark it as an "Accepted Solution"! This will help the rest of the Community with similar issues identify the verified solution and benefit from it.

MrFVD
Paper Tape
Posts: 3
Registered: ‎12-02-2019
Location: US
Views: 92
Message 5 of 6

Re: Wrong Screen size when reading using getRealMetrics

this code is used inside this product https://www.clickteam.com to let developer get the screen size of the different devices so they can scale some graphics specifically to inches and screen size.

yesterday checking against other apk I see this one that also bring the same size as we do, maybe someone in the developer area can confirm this or let us know how we proceed with this specific device.

https://play.google.com/store/apps/details?id=com.thepinkandroid.screendata&hl=en_US

Thanks again for reviewing this.

 

===========================================================

 

Just to add information this application also return a wrong size 

 

https://play.google.com/store/apps/details?id=com.vapps.screeninfo&hl=en_US

Senior MotoAgent
Senior MotoAgent
Posts: 7,185
Registered: ‎03-05-2018
Location: US
Views: 69
Message 6 of 6

Re: Wrong Screen size when reading using getRealMetrics

Hi MrFVD,

 

Thanks for more information. I'm not familiar with the application neither how they are measuring this, can't rely on the results, to be honest, but I will move the thread to the developer's community. Let see if we can get further assistance there. 

 

Best regards,
Rich
Motorola-Lenovo Support



Did someone help you today? Press the star on the left to thank them with a Kudo!
If you find a post helpful and it answers your question, please mark it as an "Accepted Solution"! This will help the rest of the Community with similar issues identify the verified solution and benefit from it.

Top Kudoed Authors