How to set sketch size as a ratio of displayWidth

I want to set my sketch in a 9:16 ratio. Processing doesn’t allow the use of variables for size() and using displayWidth and displayHeight causes it to crash. surface.setSize doesn’t work in Android Mode. What options are there?

Could you Post your Code (relevant parts)?

You might want to try using displayWidth in settings() and not Setup() (or vice-versa).

On the other Hand, if you really just want a 9:16 Ration, just do size(900,1600), or use fullscreen() if the target Display already has a 9:16 Ratio.

Ahhh settings() does work, I didn’t realise it couldn’t have orientation() in it. Thank you. Now my next question is how do I change the colour of the area outside the sketch.

I don‘t know what you mean by that… or actually, i don‘t think you can do that. That probably doesn‘t have to do with the Sketch anymore, so changing the Color shouldn‘t be possible… at least i never have Heard/seen that

Please read following topic.

You cant in void setup, but you can in void settings.