Android How do I correctly get the value from a Switch?

前端 未结 5 1295
醉酒成梦
醉酒成梦 2020-12-07 22:02

I\'m creating a Android application which uses a Switch.
I\'m trying to listen for changes and get the value when changed.
I have two questions when usi

5条回答
  •  清歌不尽
    2020-12-07 22:51

    I added this in kotlin

    switchImage.setOnCheckedChangeListener { compoundButton: CompoundButton, b: Boolean ->
        if (b) // Do something
        else // Do something
    }
    

提交回复
热议问题