Skip to content
This repository was archived by the owner on Jul 11, 2025. It is now read-only.
This repository was archived by the owner on Jul 11, 2025. It is now read-only.

Per-app Language Preferences Sample screen flash and android:configChanges problem #481

@winstonsung

Description

@winstonsung

Steps to reproduce:

Without layoutDirection|locale|screenLayout added to android:configChanges

  • Testing in API 35
    • Works as expected: UI stringResource strings did change when switching language
    • Unexpected: screen flashes (completely black screen before showing changed UI string)
  • Testing in API 31 & API 24
    • Works as expected: UI stringResource strings did change when switching language
    • Works as expected: screen won't flash

With layoutDirection|locale|screenLayout added to android:configChanges

To fix the screen flash problem during language switching, I tried to add layoutDirection|locale to android:configChanges to <activity>

  • Testing in API 35
    • Works as expected: UI stringResource (string changed when switching language)
    • Works as expected: screen won't flash again
  • Testing in API 31 & API 24
    • Unexpected: UI stringResource strings didn't change when switching language (only the current language label of the language dropdown changed)
      • Testing in another application with AnimatedVisibility used: the string only changed to the switched language when they change their visibility
    • Works as expected: screen won't flash

Additional information

There are several articles mentioned attachBaseContext and onConfigurationChanged, but I couldn't find any up-to-date solution.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions