Skip to content

Instantly share code, notes, and snippets.

@dilrajsingh1997
Last active December 6, 2021 14:46
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 dilrajsingh1997/1341d4833384b095030d86dd6b387fed to your computer and use it in GitHub Desktop.
Save dilrajsingh1997/1341d4833384b095030d86dd6b387fed to your computer and use it in GitHub Desktop.
val UserPage_UniqueUserNavType: NavType<User> = object : NavType<User>(false) {
override val name: String
get() = "uniqueUser"
override fun get(bundle: Bundle, key: String): .User? {
return bundle.getParcelable(key)
}
override fun parseValue(value: String): User {
return gson.fromJson(value, object : TypeToken<User>() {}.type)
}
override fun put(bundle: Bundle, key: String, value: User) {
bundle.putParcelable(key, value)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment