setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
Called on an activity, will lock it to landscape. Look for the other flags in the ActivityInfo class. You can lock it back to portrait or make it sensor/slider driven.
More info here: http://www.devx.com/wireless/Article/40792