How to get switch checked based on different boolean variable? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

How to get switch checked based on different boolean variable?

I'm making an app with room database and in my form for adding items there are a few switches. I'm now working on a possibility of editing the items. When I click one it connects to a form where I can change the strings and switches. And I need the switch to be on if it was checked when added. I got that text fields show previous text, but the switches don't light up. The code that I have but doesn't work is: view.switch_seen_update.setText(args.currentMovie.seen) And text fields that work look like this : view.title_update.setText(args.currentMovie.title)

5th Jul 2021, 12:46 PM
FeluzMK
1 Answer
0
Is not setText(), because it modifies the text associated to switch not the check/uncheck is setChecked()
13th Jul 2021, 11:46 AM
David Delgado
David Delgado - avatar