1

I want to create slide switch for example(on/off) currently shows on if i slide to off will enable and also know which status is currently shows pls help me.

Vicky
  • 285
  • 2
  • 4
  • 13

2 Answers2

0

Use Switch and its setOnCheckedChangeListener and a OnCheckedChangeListener(CompoundButton buttonView, boolean isChecked), that gets called whenever the switch is touched, and check the value of isChecked to know the state of the switch. This also applies to ToggleButton; check the Tutorial on both of them for more information. (I think Switch is only available from Android 4.0 on)

Moises Jimenez
  • 1,962
  • 3
  • 21
  • 43
-2

You can use ToggleButton There is more information about ToggleButton

Sardor Dushamov
  • 1,665
  • 3
  • 17
  • 44