File tree Expand file tree Collapse file tree 1 file changed +10
-8
lines changed
app/src/main/java/de/davis/passwordmanager/ktx Expand file tree Collapse file tree 1 file changed +10
-8
lines changed Original file line number Diff line number Diff line change 1- @file:Suppress(" DEPRECATION" )
2-
31package de.davis.passwordmanager.ktx
42
5- import android.os.Build
63import android.os.Bundle
4+ import androidx.core.os.BundleCompat
75
86fun <A > Bundle.getParcelableCompat (key : String , clazz : Class <A >): A ? {
9- return if (Build .VERSION .SDK_INT >= Build .VERSION_CODES .TIRAMISU ) {
10- classLoader = clazz.classLoader
11- getParcelable(key, clazz)
12- } else
13- getParcelable(key) as ? A
7+ classLoader = clazz.classLoader
8+
9+ // Due to issues with the new getParcelable API in Android API 33, BundleCompat.getParcelable
10+ // is utilized here to ensure stable behavior across different Android versions. This workaround
11+ // selectively applies the new getParcelable implementation for API levels 34 and above,
12+ // addressing the reported bug.
13+ // For more details, refer to the Google Issue Tracker: https://issuetracker.google.com/issues/274185314
14+ // and the related discussion on Stack Overflow: https://stackoverflow.com/questions/76067109/getparcelable-crashes-due-to-null-iftable-in-agp-8
15+ return BundleCompat .getParcelable(this , key, clazz)
1416}
You can’t perform that action at this time.
0 commit comments