Hi there,
I am relatively new to developing an android app and wanted to make my button change text from Start to Stop, so I did the following:
However, I am confused and struggling as to how I can then change the text back from Stop to Start and alternate it from Start to Stop and so on.
Is there any way I can do this?
Thanks,
salm2s
I am relatively new to developing an android app and wanted to make my button change text from Start to Stop, so I did the following:
Code:
start_button.setOnClickListener {
fun setStop() {
if (start_button.text == "Start") {
start_button.setText("Stop")
}
}
setStop()
However, I am confused and struggling as to how I can then change the text back from Stop to Start and alternate it from Start to Stop and so on.
Is there any way I can do this?
Thanks,
salm2s