Created
February 6, 2024 10:22
-
-
Save yccheok/a6c14ae0b759554e2e161d4a44ec9c56 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static <E extends Enum<E>> void putExtra( | |
@NonNull Intent intent, | |
@NonNull String key, | |
@NonNull E enumValue) { | |
intent.putExtra( | |
key, | |
enumValue.name() | |
); | |
} | |
public static <E extends Enum<E>> E readFrom( | |
@NonNull Bundle bundle, | |
@NonNull String key, | |
@NonNull Class<E> enumType) { | |
final String name = bundle.getString(key); | |
return Enum.valueOf(enumType, name); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment