Mario Adam
05/26/2023, 6:55 AMDuration.toMinutesPart()
in java.time.Duration
which is only available at API level 31+. My app needs to use 29 as min sdk (as I unfortunately have to support devices with this level). How can I write an own extension method, that will be used when using min sdk 29, but gets replaced by the native implementation at level 31+?lazynoda
05/26/2023, 7:28 AMBuild.VERSION.SDK_INT >= 31
and act accordingly. That's what classes like ActivityCompat
, ContextCompat
are so on are doing.
https://cs.android.com/androidx/platform/frameworks/support/+/androidx-main:core/cor[…]ndroidx/core/content/ContextCompat.java;l=582?q=ContextCompat