Skip to main content
Rlgo

Resource ids cannot be used in switch case

Problem #

In an Android library module, resource id cannot be used in a switch statement This is because switch case require a constant value but resource id in library module is not constant.

Solution #

Replace switch statement with if else statement

Reference #

https://blog.csdn.net/yeluofengchui/article/details/95514835