I need to pass a boolean value to and intent and back again when the back button is pressed. The goal is to set the boolean and use a conditional to prevent multiple launche
This is how you do it in Kotlin :
val intent = Intent(this@MainActivity, SecondActivity::class.java) intent.putExtra("sample", true) startActivity(intent) var sample = false sample = intent.getBooleanExtra("sample", sample) println(sample)
Output sample = true