Skip to content

Commit ccc4792

Browse files
author
Vladimir Enchev
committed
Switch for Android listener added
1 parent 173d352 commit ccc4792

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

ui/switch/switch.android.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,14 @@ export class Switch extends view.View {
99
constructor() {
1010
super();
1111
this._android = new android.widget.Switch(application.android.currentContext);
12+
13+
var that = this;
14+
this._android.setOnCheckedChangeListener(new android.widget.CompoundButton.OnCheckedChangeListener({
15+
onCheckedChanged: function (sender, isChecked) {
16+
that.updateTwoWayBinding(Switch.checkedProperty, sender.isChecked());
17+
that.setProperty(Switch.checkedProperty, sender.isChecked());
18+
}
19+
}));
1220
}
1321

1422
get android(): android.widget.Switch {

0 commit comments

Comments
 (0)