How to fix layout orientation to portrait and do not allow changing from portrait to landscape during run time?
Use setRequestedOrientation() as shown:
setRequestedOrientation()
public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);