You don't need to declare screen orientation in the Manifest.xml file, you can set the screen's orientation in the onCreate method in your Activity which is called when your program runs.
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
this.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
}
You can use other orientations as well. This will keep the orientation the same throughout the program's lifecycle.
If however, you want it to return to another setting after OnDestroy is called, simply save the orientation setting using sharedPreferences (https://developer.android.com/reference/android/content/SharedPreferences.html) and then write an if else statement to change the value after the event.