I have to detect when the configuration has changed. I have put the configChanges conditions in the manifest
<activity
android:name=".WorkoutActivity"
android:configChanges="orientation|keyboardHidden|screenSize">
</activity>
There are no setRequestedOrientation in the activity or in any fragment. Here is the code for configuration change:
@Override
public void onConfigurationChanged(Configuration newConfig) {
super.onConfigurationChanged(newConfig);
Toast.makeText(this, "activity rotated", Toast.LENGTH_SHORT).show();
}