GithubHelp home page GithubHelp logo

Comments (4)

kuwapa avatar kuwapa commented on July 18, 2024

On looking further into this, I released this is happening because the createBinding() {} which is annotated with @OnLifecycleEvent(Lifecycle.Event.ON_CREATE) in ActivityViewBindingDelegate is called after onCreate() in the activity is done executing.

So everything in onCreate() which expects the views to be already on the screen and rendered are not present at all. Seems like this is how lifecycle observer is supposed to work. So this way of view-binding wont work for me. setContentView needs to be called after super.onCreate and not somewhere after or in the middle of onCreate() execution.

Is there someway this can be done?

from kahelpers.

FunkyMuse avatar FunkyMuse commented on July 18, 2024

There are few options you can use here.

  1. Move your logic in onPostCreate (i think you didn't read the updated article i made an issue the first time i published it, instead of onCreate i was supposed to use onPostCreate)
  2. use by viewBinder() and manually set the setContentView like you do

from kahelpers.

FunkyMuse avatar FunkyMuse commented on July 18, 2024

Take a look in the updated README

from kahelpers.

kuwapa avatar kuwapa commented on July 18, 2024

Option 1 is good. I'd forgotten about onPostCreate. But I'm gonna go with option 2 for now as it'll need minimum changes. Thanks.

from kahelpers.

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.