0

I already found a bunch of similar problems related with this topic and I knew the solution was to append "screenSize" to the android:configChanges attribute(please refer to onConfigurationChanged not getting called if you're interested). But it does not work for my situation.

My application was built on Android 2.2(API level 8) and the device is installed with 2.3(API level 9). Any clues? Thank you in advance.

Related Manifest.xml fragments have been attached:

<application android:icon="@drawable/icon" android:label="@string/app_name"
         android:debuggable="true">
        <activity android:name="com.erlinyou.Erlinyou"
                  android:label="@string/app_name"                  
                  android:configChanges="orientation">                  
                  android:launchMode="singleInstance">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
</application>
Community
  • 1
  • 1
Zhenyu
  • 3
  • 4
  • Inside the activity tag from your AndroidManifest.xml do you have android:configChanges="orientation" ? – Blackbelt May 23 '13 at 10:17
  • Sure. I check it carefully. – Zhenyu May 23 '13 at 11:44
  • post your manifest and the code where you override onConfigurationChanged – Blackbelt May 23 '13 at 11:47
  • It has been attached. BTW, I happened to find the related topic of http://stackoverflow.com/questions/6457659/android-onconfigurationchanged-not-being-called?rq=1 already answered my question. There exist quite a few calls to setRequestedOrientation in my codes. And it works after I remove them all. Thanks for your time and help! – Zhenyu May 24 '13 at 01:31
  • One related topic of http://stackoverflow.com/questions/6457659/android-onconfigurationchanged-not-being-called?rq=1 already answered the question. – Zhenyu May 24 '13 at 01:36
  • did you override onConfigurarionChanged? May I see you code? – Blackbelt May 24 '13 at 05:59
  • One related topic of http://stackoverflow.com/questions/6457659/android-onconfigurationchanged-not-being-called?rq=1 already answered the question. – Zhenyu May 25 '13 at 06:46

2 Answers2

0

*onConfigurationChanged *

The onConfigurationChanged method.. only above 3.2 api

saravanan
  • 388
  • 2
  • 18
  • 2
    the View.onConfigurationChanged has been introduced with the api 3.2. The Activity one is from api level 1 – Blackbelt May 23 '13 at 10:15
  • ok.. Mr.blackbelt but onConfigurationChanged method not called below 3.2 why – saravanan May 23 '13 at 10:17
  • You have to ask to the OP not me . I was only pointing out the incompleteness of your answer – Blackbelt May 23 '13 at 10:18
  • as suggested by @blackbelt check the link http://developer.android.com/reference/android/app/Activity.html#onConfigurationChanged(android.content.res.Configuration) – Raghunandan May 23 '13 at 10:20
  • @Raghunandan: can u help me pls – saravanan May 23 '13 at 10:24
  • @Raghunandan: Yeah, I did read the specification for this API though I do not finish the full page. But I still cannot figure out a solution for my problem. Any more detailed guidance? – Zhenyu May 23 '13 at 11:49
0

It depends on your setting of targetSdkVersion. See below explanation from Google. It means:

for targetSdkVersion is lower than 13(HONEYCOMB_MR2), set android:configChanges="orientation" for your Activity.

for targetSdkVersion is or greater 13(HONEYCOMB_MR2), set android:configChanges="orientation|screenSize" for your Activity.

http://developer.android.com/reference/android/R.attr.html#configChanges screenSize The current available screen size has changed. If applications don't target at least HONEYCOMB_MR2 then the activity will always handle this itself (the change will not result in a restart). This represents a change in the currently available size, so will change when the user switches between landscape and portrait.

Hope it works for you.

Jagger
  • 2,352
  • 2
  • 13
  • 12