private void lockActivityOrientation(){
int orientation = getResources().getConfiguration().orientation;
int activityOrientation = 0;
if (orientation == Configuration.ORIENTATION_LANDSCAPE) {
activityOrientation = ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE;
} else {
activityOrientation = ActivityInfo.SCREEN_ORIENTATION_PORTRAIT;
}
setRequestedOrientation(activityOrientation);
}