Android width and height issue

Hi…i am displaying text at width/2-100 , height/2 -100 ,the ellipse is at (width/2 , height/2 ,200,200)…The text is expected to start at the beginning of the ellipse…but it varies according to the phone…in some phones it goes way right
CONCLUSION: The co ordinates vary from phone to to solves this.

@Yash === can you precise the phones you are using (what phone display right and what phone display false) because i cannot see any reason for that (from your code). Also some screenshots will be usefull…

First one is redmi note5 pro
Second is y2
Using fullscreen() in setup.

I meant right side’(right)
Also the ellipse scale differs from phone to phone.I saw displaydensity variable in forum… what exactly is it…does it affect my rest of code where i use the radius of ellipse.
The size of shapes and text vary from phone to phone as you see in the image

@Yash === the 2 phones are very different from res dpi point of view; first one is xxhdpi or xxxhdpi, second one is mdpi or hdpi; that explains why the size of the shapes changes: it has to be smaller for the 1°, bigger for the second one (and you can easily calculate the ratio for the change); that also explains why the textSize changes according to the same ratio. Normally android solves this kind of problem using as units not the pixels but what it calls dip (density independent pixel) that you can calculate (and code, i can put code for that)… Now, what i cannot understand is that the textstyle is not the same (ital and standard) and also why the “score 0” is at the same coord in the 2 cases and not the other text; could you put the complete code you are using at this moment, complete= from the setup to the ellipse and text.

Sorry for not mentioning.i have changed the font style for my phone just to test the fonts…and also initially i have set the text using cordiantes like 900,600 which made the text to the center in my phone not the others…
I have recently put width/2 -100 height/2 -100 but haven’t debugged in other phones.does that work on other phones the same?Thanks for responding.You are so kind

@Yash === as for testing on other phones you have to put the code you are using… Another difference could explain the problem: first one is (default) orientation landscape, other one is portrait.

No both are landscape…so i wll try out the code in other phones after you suggest me how to implement dpi… should i multiply the size of text and shapes with displaydensity…does that affect my collisions …?

After implementing dpi…and scaling everything to the original irrespective of device … i wl try it out in other phones and see it works… so please tell about dpi implementation

Regarding width and height… i used fullscreen ()…and then width and height…do i need to get device specific width and could i do that in processing for android?

Its not about the orientation or something ,the code is same for both, i ve just shared the app in other phone.
Help me fix the above two issues i think that will work :blush: