I want to have a setText with an if statement inside, so I can easily pick a value for viewing. I remember seeing something like it in MIT App Inventor, so I think it's possible.
For example,
textView.setText(if (value == 0) {"no"}else {"yes"};
I want to have a setText with an if statement inside, so I can easily pick a value for viewing. I remember seeing something like it in MIT App Inventor, so I think it's possible.
For example,
textView.setText(if (value == 0) {"no"}else {"yes"};
Copyright © 2021 Jogjafile Inc.
You can use the ternary operator.
Note that you can always just write out the
ifandelsestatements directly, though.