Stanislav
Stanislav

Reputation: 405

Tablets: android:configChanges="orientation|screenSize" and screen disabling issue

I have application with screen rotation. rotating mechanism i handle with configChanges:

<activity
    android:name=".ui.activity.MainActivity"
    android:label="@string/app_name"
    android:configChanges="orientation|screenSize"
    android:screenOrientation="fullSensor"
    android:windowSoftInputMode="adjustResize">
    <intent-filter>
        <action android:name="android.intent.action.MAIN" />
        <category android:name="android.intent.category.LAUNCHER" />
    </intent-filter>
</activity>

Problem: When user turn off screen, rotate device on 90 degrees and unblock it screen start with "old" orientation of my app, it look ugly.

here scheme:

enter image description here after block and rotate i get this after screen rotation blink and app come to normal

try it on Nexus 5(android v5) and Nesus 10(android v4.4), at phones all works fine

Upvotes: 0

Views: 520

Answers (1)

FunkTheMonk
FunkTheMonk

Reputation: 10938

Adding android:configChanges="orientation|screenSize" tells the system that you are going to handle these config changes yourself, and for the system to not do anything about it. By removing them, your activity will be recreated with the correct layouts when you rotate.

If you're using configChanges to avoid the activity being recreated, I feel bad for you son.

Upvotes: 2

Related Questions