22

If changing the orientation of my phone or the emulator I get the following output in LogCat:

04-09 11:55:26.290: INFO/WindowManager(52): Setting rotation to 1, animFlags=0
04-09 11:55:26.300: INFO/ActivityManager(52): Config changed: { scale=1.0 imsi=310/260 loc=en_US touch=3 keys=2/1/1 nav=3/1 orien=2 layout=18}
04-09 11:55:26.460: INFO/UsageStats(52): Unexpected resume of client while already resumed in client
04-09 11:55:26.579: INFO/SearchPosition(807):  Activity is paused
04-09 11:55:26.689: INFO/SearchPosition(807):  Activity is resuming

SearchPosition is the activity that is displayed. Activity is paused is written in the onPause Method and Activity is resuming in the onResume method of the activity.

I googled a little bit for the error message but I don't fully understand the meaning of it. I think it could mean that the old Activity is not properly destroyed after changing the screen orientation.

Is this correct? If yes what causes the error? If this is not correct? What is the meaning of this output?

Janusz
  • 187,060
  • 113
  • 301
  • 369
  • 2
    Are you using any type of async task? – Steve Apr 09 '10 at 12:58
  • In some of my activitys yes but I encounter this output in every activity even without a async task. – Janusz Apr 09 '10 at 13:37
  • post your onCreate() function! – Jorgesys Apr 09 '10 at 17:09
  • I am running into this situation with my app when I invoke AsyncTasks. The problem only happens if I use proguard on the app, not otherwise. Anyone has a clue? – inder Jul 13 '11 at 22:41
  • 1
    for a correct answer see this question: http://stackoverflow.com/questions/3851363/what-is-going-on-with-the-unexpected-resume-of-packagename-while-already-resu – bigstones Sep 01 '12 at 21:36

3 Answers3

12

Add this into the the activity declaration in your manifest.xml:

android:configChanges="orientation"

Example:

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

https://developer.android.com/guide/topics/manifest/activity-element.html#config

For Devices with QWERTY keyboard

android:configChanges="keyboardHidden|orientation"
Vadim Kotov
  • 8,084
  • 8
  • 48
  • 62
Jorgesys
  • 124,308
  • 23
  • 334
  • 268
  • 1
    this saved me alot of time. I would never have guess that was what the problem was. – nont Dec 09 '10 at 17:41
  • Explanation of this configuration: http://developer.android.com/guide/topics/resources/runtime-changes.html – Leventix Dec 23 '10 at 21:28
4

Example usage of android:configChanges="orientation" in AdroidManifest.xml file:

 <activity android:name=".Sound"
            android:configChanges="orientation"
                  android:label="@string/app_name" android:debuggable="true" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
BraveNewMath
  • 8,090
  • 5
  • 46
  • 51
3

I stumbled here first and after I read the link provided by leventix in his comment I can't help but think that both of the answers are actually wrong. Then I found the earlier question 3851363 which is about the same issue. The message is benign.

Correct me if I'm wrong, but I understood that the config option android:configChanges="orientation" should only be used when you want to handle the config changes yourself and not go through the typical onDestroy/onCreate cycle.

The android-8 seems to spawn the error in question needlessly in normal circumstances when the orientation changes.

Tommi Kyntola
  • 704
  • 6
  • 8