Hi,
This question was asked before but can't remember where.. if you searched a little..
In general you need to compare the height and width of the activity.. if the height is bigger then it is in portrait.. (something like this).
Sorry misunderstanding.. I thought you are looking for getting the orientation, not setting it.
You will have to create an option instructing the user to select the orientation and save it on a file, when the app starts, check the value of that flag and adjust the orientation accordingly.