Quantcast
Channel: basic android: syntax for switch statement instead of else-if - Stack Overflow
Browsing all 4 articles
Browse latest View live

Answer by Jason Robinson for basic android: syntax for switch statement...

What the people above me said is correct, but for the sake of using a switch statement for the hell of it, you could set an OnCheckedChangedListener on your RadioGroup, then use a class like...

View Article



Answer by Vladislav Zorov for basic android: syntax for switch statement...

A switch is used on one variable - i.e. you have x, which can equal 3,5 or 7. Then you switch x and give several cases - what to do on each possible value (you can also have a default case, when none...

View Article

Answer by Ted Hopp for basic android: syntax for switch statement instead of...

If you're talking about the if-else statements in calculate(), you can't replace it directly with a switch statement. The case values in a switch statement need to be compile-time constants (either...

View Article

basic android: syntax for switch statement instead of else-if

I am working on an android beginner's tutorial that is a tip calculator. It runs properly, but I was wondering how to replace the else-if statement with a switch statement. Not that it is that...

View Article
Browsing all 4 articles
Browse latest View live




Latest Images