0

I am actually having the following problem : I can not enter in the method onConfigurationChanged when I change the orientation of the emulator.

This is my method :

@Override
public void onConfigurationChanged(Configuration newConfig) {
    super.onConfigurationChanged(newConfig);
 // Checks the orientation of the screen
    if (newConfig.orientation == Configuration.ORIENTATION_LANDSCAPE) {
        Log.i("ORIENTATION", "CHANGED TO LANDSCAPE");



    } else if (newConfig.orientation == Configuration.ORIENTATION_PORTRAIT){
        Log.i("ORIENTATION", "CHANGED TO PORTRAIT");
    }
}

I do not have any log when i change the orientation ..

I have read that a modification happened from the older version about the manifest, the older verstion was :

**android:configChanges="orientation|keyboard"**

And the new one is :

**android:configChanges="orientation|keyboard|screenSize"**

My manifest :

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.fruitsapp"
    android:versionCode="1"
    android:versionName="1.0" >

    <uses-sdk
        android:minSdkVersion="8"
        android:targetSdkVersion="18" />

    <application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >
        <activity
            android:name="com.example.fruitsapp.MenuFruitsActivity"
            android:label="@string/app_name"
            android:configChanges="orientation|keyboard|screenSize"
            >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>

         <activity 
             android:label="@string/app_name" 
             android:name=".DescriptionFruitActivity"
             android:configChanges="orientation|keyboard|screenSize">
         </activity>

    </application>



</manifest>

Unfortunatly, after loads of tries, I still not have Log to signal that my orientation changed ..

Regards.

1 Answers1

0

Try this one.....

android:configChanges="orientation|keyboardHidden|screenSize"

Hope this helps.

Siddharth_Vyas
  • 9,972
  • 10
  • 39
  • 69