I want that my Switch change to checked if some condition is true, else, show a toast informing the user what happen. I'm trying:
switch?.setOnclickListener{
if(condition) switch!!.isChecked=true
else
//Show toast
}
But i know that condition is false and the switch change to checked. How to do the change of switch only when some condition is true?