When I use ViewModel.Factory, appear `Kodein No binding found for bind()` errorR cannot be resolved - Android error'Must Override a Superclass Method' Errors after importing a project into Eclipse“Debug certificate expired” error in Eclipse Android pluginsHow do I fix “Failed to sync vcpu reg” error?LogCat message: The Google Play services resources were not found. Check your project configuration to ensure that the resources are includedError retrieving parent for item: No resource found that matches the given name after upgrading to AppCompat v23Warning: This AsyncTask class should be static or leaks might occurAndroid Architecture Components, android binding and LiveDataDagger 2 - two instances of the same View model are createdKotlin Object saving into the Room Database with MVVM Design Pattern using Kodein

RPI3B+: What are the four components below the HDMI connector called?

How would my creatures handle groups without a strong concept of numbers?

Contexte et orthographe du mot « feedback »

What explains 9 speed cassettes price differences?

US Civil War story: man hanged from a bridge

What's the point of having a RAID 1 configuration over incremental backups to a secondary drive?

How to loop for 3 times in bash script when docker push fails?

Why isn't there research to build a standard lunar, or Martian mobility platform?

Is there any word for "disobedience to God"?

Why isn't pressure filtration popular compared to vacuum filtration?

Optimization terminology: "Exact" v. "Approximate"

Received a dinner invitation through my employer's email, is it ok to attend?

How can I get a player to accept that they should stop trying to pull stunts without thinking them through first?

Print the last, middle and first character of your code

Why did Harry Potter get a bedroom?

Is anyone advocating the promotion of homosexuality in UK schools?

Why presheaves are generalized objects?

Shortest hex dumping program

Why are they 'nude photos'?

Is a 10th-level Transmutation wizard considered a shapechanger for the purpose of effects such as Moonbeam?

Do I have a right to cancel a purchase of foreign currency in the UK?

How to properly say "bail on somebody" in German?

How were Martello towers supposed to work?

Good resources for solving techniques (Metaheuristics, MILP, CP etc)



When I use ViewModel.Factory, appear `Kodein No binding found for bind()` error


R cannot be resolved - Android error'Must Override a Superclass Method' Errors after importing a project into Eclipse“Debug certificate expired” error in Eclipse Android pluginsHow do I fix “Failed to sync vcpu reg” error?LogCat message: The Google Play services resources were not found. Check your project configuration to ensure that the resources are includedError retrieving parent for item: No resource found that matches the given name after upgrading to AppCompat v23Warning: This AsyncTask class should be static or leaks might occurAndroid Architecture Components, android binding and LiveDataDagger 2 - two instances of the same View model are createdKotlin Object saving into the Room Database with MVVM Design Pattern using Kodein






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








1















I reference to http://kodein.org/Kodein-DI/?6.1/android#view-model-factory use the kodein viewmodel, appeared the error.



the part code



bind<ViewModelProvider.Factory>() with singleton KodeinViewModelFactory(instance()) 


class KodeinViewModelFactory(private val kodein: Kodein) : ViewModelProvider.Factory 

override fun <T : ViewModel> create(modelClass: Class<T>): T =
kodein.direct.Instance(TT(modelClass))










share|improve this question




























    1















    I reference to http://kodein.org/Kodein-DI/?6.1/android#view-model-factory use the kodein viewmodel, appeared the error.



    the part code



    bind<ViewModelProvider.Factory>() with singleton KodeinViewModelFactory(instance()) 


    class KodeinViewModelFactory(private val kodein: Kodein) : ViewModelProvider.Factory 

    override fun <T : ViewModel> create(modelClass: Class<T>): T =
    kodein.direct.Instance(TT(modelClass))










    share|improve this question
























      1












      1








      1








      I reference to http://kodein.org/Kodein-DI/?6.1/android#view-model-factory use the kodein viewmodel, appeared the error.



      the part code



      bind<ViewModelProvider.Factory>() with singleton KodeinViewModelFactory(instance()) 


      class KodeinViewModelFactory(private val kodein: Kodein) : ViewModelProvider.Factory 

      override fun <T : ViewModel> create(modelClass: Class<T>): T =
      kodein.direct.Instance(TT(modelClass))










      share|improve this question














      I reference to http://kodein.org/Kodein-DI/?6.1/android#view-model-factory use the kodein viewmodel, appeared the error.



      the part code



      bind<ViewModelProvider.Factory>() with singleton KodeinViewModelFactory(instance()) 


      class KodeinViewModelFactory(private val kodein: Kodein) : ViewModelProvider.Factory 

      override fun <T : ViewModel> create(modelClass: Class<T>): T =
      kodein.direct.Instance(TT(modelClass))







      android kodein






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Mar 26 at 2:14









      Jie XuJie Xu

      687 bronze badges




      687 bronze badges






















          1 Answer
          1






          active

          oldest

          votes


















          1














          It's quite simple, you just need to directly transfer Kodein to the factory, without instance()



          class KodeinApp : Application(), KodeinAware 
          override val kodein by Kodein.lazy
          import(androidXModule(this@KodeinApp))
          bind() from singleton KodeinViewModelFactory(kodein)
          bind() from singleton MyViewModel(kodein)







          share|improve this answer






















            Your Answer






            StackExchange.ifUsing("editor", function ()
            StackExchange.using("externalEditor", function ()
            StackExchange.using("snippets", function ()
            StackExchange.snippets.init();
            );
            );
            , "code-snippets");

            StackExchange.ready(function()
            var channelOptions =
            tags: "".split(" "),
            id: "1"
            ;
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function()
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled)
            StackExchange.using("snippets", function()
            createEditor();
            );

            else
            createEditor();

            );

            function createEditor()
            StackExchange.prepareEditor(
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: true,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            bindNavPrevention: true,
            postfix: "",
            imageUploader:
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            ,
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            );



            );













            draft saved

            draft discarded


















            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55348908%2fwhen-i-use-viewmodel-factory-appear-kodein-no-binding-found-for-bindkodein%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown

























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            1














            It's quite simple, you just need to directly transfer Kodein to the factory, without instance()



            class KodeinApp : Application(), KodeinAware 
            override val kodein by Kodein.lazy
            import(androidXModule(this@KodeinApp))
            bind() from singleton KodeinViewModelFactory(kodein)
            bind() from singleton MyViewModel(kodein)







            share|improve this answer



























              1














              It's quite simple, you just need to directly transfer Kodein to the factory, without instance()



              class KodeinApp : Application(), KodeinAware 
              override val kodein by Kodein.lazy
              import(androidXModule(this@KodeinApp))
              bind() from singleton KodeinViewModelFactory(kodein)
              bind() from singleton MyViewModel(kodein)







              share|improve this answer

























                1












                1








                1







                It's quite simple, you just need to directly transfer Kodein to the factory, without instance()



                class KodeinApp : Application(), KodeinAware 
                override val kodein by Kodein.lazy
                import(androidXModule(this@KodeinApp))
                bind() from singleton KodeinViewModelFactory(kodein)
                bind() from singleton MyViewModel(kodein)







                share|improve this answer













                It's quite simple, you just need to directly transfer Kodein to the factory, without instance()



                class KodeinApp : Application(), KodeinAware 
                override val kodein by Kodein.lazy
                import(androidXModule(this@KodeinApp))
                bind() from singleton KodeinViewModelFactory(kodein)
                bind() from singleton MyViewModel(kodein)








                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Jun 22 at 17:40









                Ivan TIvan T

                1495 bronze badges




                1495 bronze badges


















                    Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.







                    Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.



















                    draft saved

                    draft discarded
















































                    Thanks for contributing an answer to Stack Overflow!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid


                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.

                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function ()
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55348908%2fwhen-i-use-viewmodel-factory-appear-kodein-no-binding-found-for-bindkodein%23new-answer', 'question_page');

                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

                    Swift 4 - func physicsWorld not invoked on collision? The Next CEO of Stack OverflowHow to call Objective-C code from Swift#ifdef replacement in the Swift language@selector() in Swift?#pragma mark in Swift?Swift for loop: for index, element in array?dispatch_after - GCD in Swift?Swift Beta performance: sorting arraysSplit a String into an array in Swift?The use of Swift 3 @objc inference in Swift 4 mode is deprecated?How to optimize UITableViewCell, because my UITableView lags

                    Access current req object everywhere in Node.js ExpressWhy are global variables considered bad practice? (node.js)Using req & res across functionsHow do I get the path to the current script with Node.js?What is Node.js' Connect, Express and “middleware”?Node.js w/ express error handling in callbackHow to access the GET parameters after “?” in Express?Modify Node.js req object parametersAccess “app” variable inside of ExpressJS/ConnectJS middleware?Node.js Express app - request objectAngular Http Module considered middleware?Session variables in ExpressJSAdd properties to the req object in expressjs with Typescript