Skip to content

Instantly share code, notes, and snippets.

@yveskalume
Created April 6, 2022 18:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yveskalume/f29b215f5918af366893e622b19e1b84 to your computer and use it in GitHub Desktop.
Save yveskalume/f29b215f5918af366893e622b19e1b84 to your computer and use it in GitHub Desktop.
class PostType : NavType<Post>(isNullableAllowed = false) {
override fun get(bundle: Bundle, key: String): Post? {
  return bundle.getParcelable(key)
  }
override fun parseValue(value: String): Post {
  return Gson().fromJson(value, Post::class.java)
}
override fun put(bundle: Bundle, key: String, value: Post) {
bundle.putParcelable(key, value)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment