[Android] Setting screen orientation programmatically
import android.app.Activity;
import android.content.pm.ActivityInfo;
import android.os.Bundle;
public class Orientation extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
//---change to landscape mode---
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
}
}
Comments