kartik
kartik

Reputation: 191

Why doesn't the interaction of component from a different layout works in .kt file if not used in setContentView

I want to use authSwitch, which is a switch in custom layout file. I have inflated it and can access the switch inside IntroActivity.kt but the interaction doesn't seem to be reflected when interacted with it. How can I access the changes done to that switch without it using inside setContentView? I need ActivityIntroBinding which houses a pageviewer displaying different fragments in which one fragment contains the authSwitch.

binding = ActivityIntroBinding.inflate(layoutInflater)
    authBinding = IntroPageFourBinding.inflate(layoutInflater)
    setContentView(binding.root)

    authBinding.authSwitch.setOnClickListener {
        SharedFunctions().showToast(baseContext, "Pressed")
    }

Upvotes: 0

Views: 31

Answers (0)

Related Questions