I have a switch case in my code which has cases defined on String constants.
If I initialize the String constants as
String INACTIVE = "INACTIVE";
The switch case works fine.
However, If I initialize the String constants using an enum as
String INACTIVE = State.INACTIVE.name();
I get a compile-time error on the switch case saying
Constant Expression Required
I am using MVP architecture and my State Enum can be used only in the Presenter, while my switch case is in the Activity View.
I don't want to duplicate the Enum in the View keeping in mind code maintenance issues.
This forces me to define String constants separately for my switch case, but it is not allowing me to initialize the constants using State enum values.
Thanking in advance for any helpful suggestions and solutions.