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

**URL:** https://discourse.processing.org/t/how-to-make-my-sketch-fit-to-any-screen-resolution-of-android-device-made-from-apde/21762
**Category:** Processing for Android
**Created:** [June 11, 2020, 4:58am UTC](https://discourse.processing.org/t/how-to-make-my-sketch-fit-to-any-screen-resolution-of-android-device-made-from-apde/21762 "2020-06-11T04:58:03Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![Why\_I\_Use\_Processing](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/why_i_use_processing/32/9558_2.png) [@Why\_I\_Use\_Processing](https://discourse.processing.org/u/Why_I_Use_Processing)
#### Post date: [June 11, 2020, 4:58am UTC](https://discourse.processing.org/t/how-to-make-my-sketch-fit-to-any-screen-resolution-of-android-device-made-from-apde/21762/1 "2020-06-11T04:58:03Z")

</div>

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!!

---

<div class="post-metadata">

### Author: ![noel](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/noel/32/213_2.png) [@noel](https://discourse.processing.org/u/noel)
#### Post date: [June 11, 2020, 5:19am UTC](https://discourse.processing.org/t/how-to-make-my-sketch-fit-to-any-screen-resolution-of-android-device-made-from-apde/21762/2 "2020-06-11T05:19:46Z")

</div>

I always had this problem as well. My best solution for this you can find on my repo [here](https://github.com/EmmanuelPil/Android-java-code-utilities-widgets-for-Processing-for-Android).  
It’s called textWidth() & Buttons. It may seem a little confusing, but once you have a grip on it you will get reasonable results.

---

<div class="post-metadata">

### Author: ![Why\_I\_Use\_Processing](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/why_i_use_processing/32/9558_2.png) [@Why\_I\_Use\_Processing](https://discourse.processing.org/u/Why_I_Use_Processing)
#### Post date: [June 11, 2020, 9:00am UTC](https://discourse.processing.org/t/how-to-make-my-sketch-fit-to-any-screen-resolution-of-android-device-made-from-apde/21762/3 "2020-06-11T09:00:17Z")

</div>

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!!

---

<div class="post-metadata">

### Author: ![uheinema](https://avatars.discourse-cdn.com/v4/letter/u/e99b99/32.png) [@uheinema](https://discourse.processing.org/u/uheinema)
#### Post date: [June 11, 2020, 12:37pm UTC](https://discourse.processing.org/t/how-to-make-my-sketch-fit-to-any-screen-resolution-of-android-device-made-from-apde/21762/4 "2020-06-11T12:37:23Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![noel](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/noel/32/213_2.png) [@noel](https://discourse.processing.org/u/noel)
#### Post date: [June 11, 2020, 2:34pm UTC](https://discourse.processing.org/t/how-to-make-my-sketch-fit-to-any-screen-resolution-of-android-device-made-from-apde/21762/5 "2020-06-11T14:34:06Z")

</div>

> [@Why\_I\_Use\_Processing](#):
>
> But I want to do it without changing hundreds of values that I already assigned

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!
