Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
class ExampleNavType : NavType<Example>(isNullableAllowed = false) {
override fun get(bundle: Bundle, key: String): Example? {
return bundle.getParcelable(key)
}
override fun parseValue(value: String): Example {
return Gson().fromJson(value, Example::class.java)
}
override fun put(bundle: Bundle, key: String, value: Example) {
bundle.putParcelable(key, value)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment