android-tiramisu
getSerializableExtra and getParcelableExtra are deprecated. What is the alternative?
This is what I use: inline fun <reified T : Serializable> Bundle.serializable(key: String): T? = when { Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU -> getSerializable(key, T::class.java) else -> @Suppress(“DEPRECATION”) getSerializable(key) as? T } inline fun <reified T : Serializable> Intent.serializable(key: String): T? = when { Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU -> getSerializableExtra(key, T::class.java) else -> @Suppress(“DEPRECATION”) getSerializableExtra(key) as? T } … Read more
onBackPressed() deprecated, What is the alternative?
According your API level register: onBackInvokedDispatcher.registerOnBackInvokedCallback for API level 33+ onBackPressedDispatcher callback for backword compatibility “API level 13+” This requires to at least use appcompat:1.6.0-alpha03; the current is 1.6.0-alpha04: implementation ‘androidx.appcompat:appcompat:1.6.0-alpha04’ // kotlin import androidx.activity.addCallback if (BuildCompat.isAtLeastT()) { onBackInvokedDispatcher.registerOnBackInvokedCallback( OnBackInvokedDispatcher.PRIORITY_DEFAULT ) { // Back is pressed… Finishing the activity finish() } } else { onBackPressedDispatcher.addCallback(this … Read more