Giter Club home page Giter Club logo

Comments (3)

akexorcist avatar akexorcist commented on September 15, 2024

I have sample code for Dagger Hilt implementation

See

ApplicationContext was injected with @ApplicationContext into StoryProvider and also change the language from HiltFragmentWithViewModel (Fragment). This work properly (see HiltDependencyInjectionTest UI test for this implementation)

Feel free to tell me more information if part of your code that different from my sample code

from localization.

Berki2021 avatar Berki2021 commented on September 15, 2024

I have sample code for Dagger Hilt implementation

See

* [HiltFragmentWithViewModel](https://github.com/akexorcist/Localization/blob/master/app/src/main/java/com/akexorcist/localizationapp/hilt/HiltFragmentWithViewModel.kt)

* [StoryProvider](https://github.com/akexorcist/Localization/blob/master/app/src/main/java/com/akexorcist/localizationapp/hilt/StoryProvider.kt)

ApplicationContext was injected with @ApplicationContext into StoryProvider and also change the language from HiltFragmentWithViewModel (Fragment). This work properly (see HiltDependencyInjectionTest UI test for this implementation)

Feel free to tell me more information if part of your code that different from my sample code

OK I will test this later and tell you if it worked.

EDIT:

I think I know where the problem lies. I didn't test this, but what about classes that live as Singletons and have an applicationContext injected into them? Classes such as Repositories annotated with @Singleton.

I observed the following: When I change the language, the applicationContext inside my singleton classes doesn't get updated. But when I now restart the app, the applicationContext is updated because the app has been newly created.

Might this be the Issue @akexorcist ?

from localization.

akexorcist avatar akexorcist commented on September 15, 2024

Since AndroidX AppCompat has per-app language preferences for backward compatibility. Please migrate this library to AndroidX for more stability, compatibility, and longer support from Google team.

See Migrate to AndroidX guide

Thank you for your support

from localization.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.