If-else working, switch not

后端 未结 9 1838
一向
一向 2020-12-03 14:44

I am making an app that has a grid of images with text and each one opens a different activity. It works fine but just for design purposes I want to replace my if-else

9条回答
  •  谎友^
    谎友^ (楼主)
    2020-12-03 15:19

    Using a break statement after each case should fix the problem. I would also use a default statement as well after the last case.

提交回复
热议问题