Skip to content

Instantly share code, notes, and snippets.

@tpakis
Created December 16, 2020 14:40
Show Gist options
  • Save tpakis/88d0486270cde5622b9f71d9e01d142d to your computer and use it in GitHub Desktop.
Save tpakis/88d0486270cde5622b9f71d9e01d142d to your computer and use it in GitHub Desktop.
Intended use of bindview in activity
class MainActivity : AppCompatActivity() {
private val buttonBaseline: Button by bindView(R.id.button_go_to_baseline)
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
buttonBaseline.setOnClickListener {
goToABTest(ABTestVariation.BASELINE)
}
}
private fun goToABTest(variation: ABTestVariation) {
ABTestActivity.startInABTestVariation(this, variation)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment