1

I added an In-app language picker for my Compose App following this article. but everytime I change the language the screen flashes. I guess it is due to configuration changes

I downloaded the sample app out of curiosity and it has the same issue.

Is there a way to prevent these "flashes" or add a nice transition animation? Ideally I would like to just reload the string resources

Here is a gif about the issue

I tried overwriting the recreate() method in the MainActivity and editing the androidmanifest file based on these couldn't prevent the "flash" : How do I keep my android activity keep on going even if somebody switches from dark mode to day mode or vice versa (using Java) How to trigger recomposition after updateConfiguration?

3
  • Please provide enough code so others can better understand or reproduce the problem. Commented Jul 30, 2023 at 9:07
  • Have you found a solition for this? Commented Feb 1, 2024 at 12:53
  • Yes I did, please check the accepted answer @musclebananas Commented Feb 6, 2024 at 16:23

1 Answer 1

5

I figured out the solution for this:

Short answer: Add this line to your AndroidManifest.xml activity tag

android:configChanges="locale|layoutDirection"

Long answer: Read these:

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.