I simply want to do:
if(getRequestedOrientation() == ActivityInfo.SCREEN_ORIENTATION_PORTRAIT)
setContentView(R.layout.search_portrait);
else
setContentView(R.layout.search_landscape);
The problem is – getRequestedOrientation always returns -1.
Any suggestions?
If you’re just changing the layout, you should really think about putting your portrait layouts in
/res/layoutand your landscape layouts in/res/layout-land(with the same names) and Android will select the correct layout automatically.