Created
January 9, 2024 10:35
-
-
Save matinnasiri01/623a5b662fd787ed0f828e2c9cac2d23 to your computer and use it in GitHub Desktop.
android Parcelize
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
inline fun <reified T : Serializable> Intent.getSerializable(key: String): T = when { | |
SDK_INT >= 33 -> getSerializableExtra(key, T::class.java)!! | |
else -> getSerializableExtra(key) as T | |
} | |
inline fun <reified T : Parcelable> Intent.getParcelable(key: String): T = when { | |
SDK_INT >= 33 -> getParcelableExtra(key, T::class.java)!! | |
else -> getParcelableExtra(key)!! | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment