How to make my sketch fit to any screen resolution of android device made from APDE

I am making a processing sketch using APDE, the sketch runs on full screen.
I made the sketch the way that it fits over to the resolution of my android phone.
But when I switch to other phones to test it, sometimes the buttons go off the screen and all the things become magnified and wierd.

I want to know if I can fix this without changing each and every line of the code and its values. (Using scale() function or…)

Thanks in advance!!

I always had this problem as well. My best solution for this you can find on my repo here.
It’s called textWidth() & Buttons. It may seem a little confusing, but once you have a grip on it you will get reasonable results.

But I want to do it without changing hundreds of values that I already assigned to the in-buit functions of processing (rect, ellipse, image,etc…)
Please HELP!!

If you are not using any Android controls, and are only concerned about your own output

It depends:

If your design is based on fixed coordinates
on your phone, you could just
scale(width/designWidth,heght/designHeight,1.0);
at the start of draw(). (Or only for those elements which are not scaled by wifth/ height already). Has to be reversed for mousr coordinates, of course.

Additionally, or f you used width and height throughout, see above @noel

Mixing both is possible, you just have to take care of what should be scaled and whether by design_width or width.

It really depends on your sketch. You can scale it the way @uheinema suggested, but then you must also scale your whole mouse coordinate system. Another disadvantage of scaling is for instance that if you use thin lines with text, like for instance a ruler, everything will blur. Without seeing the code it’s difficult to give advice for the best solution. I’m afraid there is no simple ready solution. Welcome to the Android club!