Search code examples
javaandroidscreen-orientation

onConfigurationChanged not called anymore


My apps onConfigurationChanged is not called anymore. I have updated my SDK API to Lollipop and set the SDK Level im AndroidManifest as follow:

<uses-sdk android:minSdkVersion="12" android:targetSdkVersion="22"/>

I don't know if my changes is the reason why it is not working anymore ( worked now about 2 years without problems).

In my code overwrite "onConfigurationChanged":

    @Override
        public void onConfigurationChanged(Configuration newConfig) {

Log.v("Debug orientchange", "in onConfigurationChanged"); // <-- is never called !

In my AndroidManifest I declared:

<activity android:name=".ChronicBrowser"  android:configChanges="orientation|keyboardHidden" android:label="@string/app_name">

When I change the orientation with my device the Activity is restarted. In the past I prevented this with the already mentoined configuration/coding.

Does anyone know what changed or what I am doing wrong/missed ?

Thanks


Solution

  • From Honeycomb onwards you need also screenSize:

    android:configChanges="orientation|keyboardHidden|screenSize"