Issue
I have one of my activities which I would like to prevent from rotating because I’m starting an AsyncTask, and screen rotation makes it restart.
Is there a way to tell this activity “DO NOT ROTATE the screen even if the user is shaking his phone like mad”?
Solution
Add
android:screenOrientation"portrait"
or
android:screenOrientation"landscape"
to the <activity>
element/s in the manifest and you’re done.
Answered By – lbedogni