android:screenOrientation="portrait"
//put this <
this.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
// > In your MainActivity.java
<!-- inside of your AndroidManifest.xml -->
<activity android:name=".MainActivity"
android:screenOrientation="portrait"/>
<activity
...
...
android:screenOrientation="nosensor">