I want to change the orientation programmatically while running my Android App, with these lines of code:
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTA
See the edit by @luisfer. For targeting Android 3.2 and above, you need BOTH
android:configChanges="orientation|screenSize"
http://developer.android.com/guide/topics/resources/runtime-changes.html#HandlingTheChange