Q:

onConfigurationChanged is not working for API17

I would like to trigger something if the table were tilt from portrait to landscape or vice versa.
However the onConfigurationChanged is never get triggered.
I have read few question raised few year back from stack-overflow fans, but none is working.
for example, add android:configChanges="orientation|screenSize" inside Android.
below are the AndroidManifest.xml, app and debug logs,
thank you
D/ViewRootImpl@d3690a3[MainActivity]: Relayout returned: old=[0,0][1920,1200] new=[0,0][1920,1200] 
    result=0x7 surface={true 3874265088} changed=true
D/OpenGLRenderer: eglCreateWindowSurface = 0xe8985120, 0xe6ec9808
D/ScrollView:  onsize change changed 
E/ViewRootImpl: sendUserActionEvent() returned.
I/Choreographer: Skipped 51 frames!  The application may be doing too much work on its main thread.
D/ViewRootImpl@d3690a3[MainActivity]: MSG_RESIZED_REPORT: frame=[0,0][1920,1200] ci=[0,36][0,72] vi= 
    [0,36][0,72] or=2
D/ViewRootImpl@d3690a3[MainActivity]: MSG_WINDOW_FOCUS_CHANGED 1 1
D/InputMethodManager: prepareNavigationBarInfo() DecorView@15f6fa0[MainActivity]
D/InputMethodManager: getNavigationBarColor() -855310
D/InputMethodManager: prepareNavigationBarInfo() DecorView@15f6fa0[MainActivity]
getNavigationBarColor() -855310
V/InputMethodManager: Starting input: tba=com.example.android.predictiongua ic=null mNaviBarColor 
    -855310 mIsGetNaviBarColorSuccess true , NavVisible : true , NavTrans : false
D/InputMethodManager: startInputInner - Id : 0
I/InputMethodManager: startInputInner - mService.startInputOrWindowGainedFocus
D/InputTransport: Input channel constructed: fd=76
Input channel destroyed: fd=77
V/item: 7
V/item: 3
V/item: 8

<application
    android:allowBackup="true"
    android:icon="@mipmap/android_icon"
    android:label="xxxxxx"
    android:roundIcon="@mipmap/ic_launcher_round"
    android:supportsRtl="true"
    android:configChanges="screenSize|keyboardHidden|orientation"
    android:theme="@style/AppTheme">
    <activity android:name=".MainActivity" >
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
</application>

android {
compileSdkVersion 29
buildToolsVersion "29.0.2"
defaultConfig {
    applicationId "com.example.android.xxxxxx"
    minSdkVersion 17
    targetSdkVersion 29
    versionCode 1
    versionName "1.0"
    testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
    }
}
}

dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
androidTestImplementation('com.android.support.test.espresso:espresso-core:3.0.2', {
    exclude group: 'com.android.support', module: 'support-annotations'
})

//noinspection GradleCompatible
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
testImplementation 'junit:junit:4.12'

implementation 'net.cachapa.expandablelayout:expandablelayout:2.9.2'
implementation 'com.github.aakira:expandable-layout:1.6.0@aar'
}

A:

You should to place the following string between an "activity" tag and not between "application" try to use it like the following:
<application
    android:allowBackup="true"
    android:supportsRtl="true"
    android:theme="@style/AppTheme">

    <activity
        android:name=".MainActivity"
        android:configChanges="screenSize|keyboardHidden|orientation" >
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
</application>

