One programmatic way to do this that I can think of is to create a superclass that expands activity and extends all your classes from there.
Install the class below in a super class in a protected method and call super.xxx () to initiate this:
setRequestedOrientation (ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
If you have a specific activity differently, you can simply redefine it.
[I have not tried this yet, but according to OOP knowledge it works]
source share