I need to save my action layout in portrait mode, but still get notified when the screen orientation changes to update my own custom canvas. I managed to prevent the Android OS from reloading my activity and changing the layout when I change the orientation of the screen by putting these lines in my XML manifest:
android:screenOrientation="portrait" android:configChanges="orientation"
I also know that I can change the screen orientation programmatically by calling the setRequestedOrientation method from Activity.
The problem is that the onConfigurationChanged method does not call at all when I set the screenOrientation flag or call the setRequestedOrientation method. It makes a call when I remove the flag from the manifest, but then the layout is also updated, and that is not what I want.
Is there a way to prevent changing the OS in the layouts, but can I still catch the configuration change?
Thanks!
source share