Android examples for java.lang:Enum
parse Enum value
public class Main { public static <T extends Enum<T>> T parseEnum(String value, Class<T> enumType) { if (value != null && !value.isEmpty() && enumType != null) { try {/*from w w w. j a va2s . c o m*/ return Enum.valueOf(enumType, value); } catch (IllegalArgumentException ex) { return null; } } else { return null; } } }