Can I change what that button does. I tried just using it but when the user changes something and goes back, the changes aren't applied

Can I change what that button does. I tried just using it but when the user changes something and goes back, the changes aren't applied

It's very easy, just override onBackPress of your activity.
Check documentation for more info - https://developer.android.com/reference/android/app/Activity#onBackPressed()
Did you search for it?
Android - How To Override the "Back" button so it doesn't Finish() my Activity?
you can override onBackPressed() method in your activity
Try this simple code:
import android.os.Bundle
import android.widget.Toast
import androidx.appcompat.app.AppCompatActivity
class MainActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
}
override fun onBackPressed() {
// super.onBackPressed()
Toast.makeText(this,"Back Pressed",Toast.LENGTH_LONG).show()
}
}