Skip to content Skip to sidebar Skip to footer

Error: An Enum Switch Case Label Must Be The Unqualified Name Of An Enumeration Constant

error: an enum switch case label must be the unqualified name of an enumeration constant error: duplicate case label no compiling, help me! public class CardViewStyleSetting ex

Solution 1:

As per Java docs

The Identifier in a EnumConstant may be used in a name to refer to the enum constant.

so we need to use the name only in case of an enum.

Change to this

switch (Prefs.getCardStyle()) {
    case COMPACT: rCompact.setChecked(true); break;
    case FLAT: rFlat.setChecked(true); break;
    case MATERIAL: default: rMaterial.setChecked(true); break;
}

Post a Comment for "Error: An Enum Switch Case Label Must Be The Unqualified Name Of An Enumeration Constant"