I would like to click an image button and have it open a new activity and change the text view of that activity. Here's what I have so far, to open the new activity:
val bad = findViewById<ImageButton>(R.id.bad)
bad.setOnClickListener {
val intent = Intent(this, HomeActivity::class.java)
startActivity(intent)
}
but I don't know where to add the info for changing the TextView text onclick. I tried it this way and it worked, but the textview is in the same XML.
fun onClick(view: View) {
val text = findViewById<TextView>(R.id.textView) as TextView
text.text = "Button clicked"
}
Yes I've done extensive research on this, and even read similar posts on here. But I'm still lost. I would like a definitive answer for my specific question... so yea. Thank you in advance for your help!