Fixes of getSerializable() method of Intent is deprecated in android 13

This commit is contained in:
MohitMaliFtechiz 2023-05-31 16:16:58 +05:30 committed by Kelson
parent bd09334b4f
commit af67b0fc8c

View File

@ -64,7 +64,11 @@ open class ErrorActivity : BaseActivity() {
setContentView(activityKiwixErrorBinding!!.root)
val extras = intent.extras
exception = if (extras != null && safeContains(extras)) {
extras.getSerializable(EXCEPTION_KEY) as Throwable
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
extras.getSerializable(EXCEPTION_KEY, Throwable::class.java)
} else {
extras.getSerializable(EXCEPTION_KEY) as Throwable
}
} else {
null
}