Android determine screen orientation at runtime
Here's a pseudo code to detect screen rotate event, and decide to retain or changes the screen orientation. public boolean onOrientationChanges(orientation) { if(orientation == landscape) if(settings.get("lock_orientation")) return false; // Retain portrait mode else return true; // change to landscape mode return true; } How do I make similar things in Android? EDIT: I'm actually looking answer on Where to handle orientation changes . I do not want to fix the orientation by adding screenOrientation="portrait". I need something, similar to onConfigurationChanges(), where I can handle the