Question

If I use the version of API 3.2 Adding on Manifest ScreenSize it works perfectly, if I use the current version for my application(2.3.3), changing the orientation will not enter onConfigurationChanged.

android:configChanges="orientation|keyboardHidden|ScreenSize"

How can fix this?

I need to change the orientation doesn't create again the activity and I want to use minimum level api (2.3.3).

Thanks!

EDIT:

THIS NOT WORKS FOR ME --> android:configChanges="keyboardHidden|orientation"

Était-ce utile?

La solution 2

Finally I solved it this way:

if (this.getWindowManager().getDefaultDisplay().getOrientation() == 0 || 
        this.getWindowManager().getDefaultDisplay().getOrientation() == 2) {
    Log.e("TAG","LANDSCAPE");
}else{
    Log.e("TAG","PORTRAIT");
}

VALUES FOR: getWindowManager().getDefaultDisplay().getOrientation()

0 AND 2: LANDSCAPE 1 AND 3: PORTRAIT

With this condition in the onCreate() method we can determine the orientation in which the appliance resides.

Autres conseils

Try in manifest

        <activity
           android:label="@string/app_name"
           android:name=".activity.YourActivity" 
           android:configChanges="keyboardHidden|orientation">
        </activity>
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top