Giter Site home page Giter Site logo

sendToView about thirtyinch HOT 4 CLOSED

mikaelzero avatar mikaelzero commented on June 1, 2024
sendToView

from thirtyinch.

Comments (4)

passsy avatar passsy commented on June 1, 2024

The view is bound after it is ready to use, which is after onStart. This prevents you from accessing the view before the layout is inflated or fragments are commited.

The presenter #onCreate is called before your Activity#onCreate().

from thirtyinch.

mikaelzero avatar mikaelzero commented on June 1, 2024

Thank you for your answer

use sendToView before onStart
use getView other state
is right?

from thirtyinch.

passsy avatar passsy commented on June 1, 2024

It depends. I use getView when the view calls a method of my presenter and I can synchronously update the view. If anything is async I'd use sendToView.

Alternatively you can write some kind of render method. Update you model in the presenter and call render which is the only place the view gets updated. Like this:

private val count = 0

override fun onAttachView(view: MyView) {
    render()
}

override fun onButtonPressed() {
    count++
    render()
}

private fun render() {
    if (view == null) return // view not attached

    view.updateCount(count)
    // ...
}

from thirtyinch.

mikaelzero avatar mikaelzero commented on June 1, 2024

i think you use sendToView becasue of not call setContetView()
if i call bindView after setContentView() or inflate()
getView() can work
i think...

from thirtyinch.

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.