2

I was just checking with nougat settings on my Nexus 5x and found a setting as Display Size. I added: android:configChanges="screenSize|smallestScreenSize|screenLayout|orientation|keyboardHidden|density" for my activity in Manifest file so that I should get the event for Display Size change in onConfigurationChanged(Configuration newConfig) method in my activity.

But when I change Display Size from settings, my activity restarts and I don't even get a callback in onConfigurationChanged(Configuration newConfig). I tried adding a log, but that even isn't shown.

In Manifest file;

<activity
        android:name=".Activities.MainActivity"
        android:label="@string/home"
        android:configChanges="screenSize|smallestScreenSize|screenLayout|orientation|keyboardHidden|density"
        android:launchMode="singleTop"
        android:screenOrientation="portrait"
        android:windowSoftInputMode="adjustResize" />

In my activity,

@Override
public void onConfigurationChanged(Configuration newConfig) {
    super.onConfigurationChanged(newConfig);
    Log.e("test","executed");
    // My code here..
}

Any idea why it happens?

Floern
  • 33,559
  • 24
  • 104
  • 119
Nayan
  • 367
  • 4
  • 18

0 Answers0