Im done wih you "switch"
I have a viewpager and have its on page change listener from it i change some ui stuff like reseting previous page icon and color the new one and set the page title .
Inside of the code i used "switch" to change the stuff depending on the position.
The color did changed but the title stucked at last switch case for every page so i spent hours to find why its doing that ...
The input was ok .
So i just said lets try "if" instead and it worked ._.
Defaq switch ?
Why to use something that has a big chance to fail and theres not much to debug there ?
Whats your comment about it .
Do you ever faced something similar ?

  • 1
    If you don't use "break;" at the end of each case branch, you get stuck on the last one. It's made that way so if you have several values that need to get the same reaction or have parts in common you can chain them instead of repeating code.
  • 0
    @Eariel i had that aswell but it did not worked as expected and the input value was clear from the logs
Add Comment