# Sketch orientation Android

**URL:** <https://discourse.processing.org/t/sketch-orientation-android/28096>\
**Category:** Processing for Android\
**Created:** [February 26, 2021, 11:56am UTC](https://discourse.processing.org/t/sketch-orientation-android/28096 "2021-02-26T11:56:18Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![paulgoux](https://avatars.discourse-cdn.com/v4/letter/p/b9bd4f/32.png) [@paulgoux](https://discourse.processing.org/u/paulgoux)\
**Post date:** [February 26, 2021, 11:56am UTC](https://discourse.processing.org/t/sketch-orientation-android/28096/1 "2021-02-26T11:56:18Z")

</div>

Hi I’m looking for a solution to a small problem. I have already searched online, to find out how to lock my rotation, and came across the orientation reference.

[https://android.processing.org/reference/environment/orientation.html](https://android.processing.org/reference/environment/orientation.html)

> **[Processing 2.x and 3.x Forum](https://forum.processing.org/two/discussion/157/landscape-with-opengl-renderer-on-nexus-4#Item_5)**
>
> Processing is an electronic sketchbook, a language and a worldwide community. This is its forum.

Now the only issue that I have is that this locks the landscape version permanently meaning that if I rotate the phone 180 degrees so its now in its next landscape orientation the screen is now updside down. Any help much appreciated, thanks.

---

<div class="post-metadata">

**Author:** ![akenaton](https://avatars.discourse-cdn.com/v4/letter/a/a88e4f/32.png) [@akenaton](https://discourse.processing.org/u/akenaton)\
**Post date:** [March 1, 2021, 5:48pm UTC](https://discourse.processing.org/t/sketch-orientation-android/28096/2 "2021-03-01T17:48:57Z")

</div>

@paulgoux ===instead of locking the orientation you have to handle it by code

---

<div class="post-metadata">

**Author:** ![paulgoux](https://avatars.discourse-cdn.com/v4/letter/p/b9bd4f/32.png) [@paulgoux](https://discourse.processing.org/u/paulgoux)\
**Post date:** [March 1, 2021, 5:52pm UTC](https://discourse.processing.org/t/sketch-orientation-android/28096/3 "2021-03-01T17:52:00Z")

</div>

Can you be a bit more specific? I’d be happy to if I can see code examples online, but I cant find anything which allows me to specify the rotation once the app is loaded. Or are you saying that I have to manually rotate my app based on some variable on the phone gyro. Which again happy to do but don’t know where to start.

---

<div class="post-metadata">

**Author:** ![akenaton](https://avatars.discourse-cdn.com/v4/letter/a/a88e4f/32.png) [@akenaton](https://discourse.processing.org/u/akenaton)\
**Post date:** [March 1, 2021, 5:56pm UTC](https://discourse.processing.org/t/sketch-orientation-android/28096/4 "2021-03-01T17:56:25Z")

</div>

@paulgoux === in your manifest you precise that you are handling the orientation and of course in the setup you dont lock it; then you have an handler in the code for “orientationChanges” and here you precise what is happening when the phone is rotated for 90° or 180° or… ```based as you say on what the sensor returns through its OrientationEventListener.

more details here= [https://developer.android.com/reference/android/view/OrientationEventListener](https://developer.android.com/reference/android/view/OrientationEventListener)

---

<div class="post-metadata">

**Author:** ![paulgoux](https://avatars.discourse-cdn.com/v4/letter/p/b9bd4f/32.png) [@paulgoux](https://discourse.processing.org/u/paulgoux)\
**Post date:** [March 1, 2021, 9:58pm UTC](https://discourse.processing.org/t/sketch-orientation-android/28096/5 "2021-03-01T21:58:05Z")

</div>

Thank you ill take a look later.
