If I write:
bmp.compress(Bitmap.CompressFormat.WEBP_LOSSLESS, 80, image)
Android Studio shows an error message:
Field requires API level 30 (current min is 21) And if I write:
bmp.compress(Bitmap.CompressFormat.WEBP, 80, image)
says:
WEBP is deprecated. Deprecated in Java.
Should I do this?:
if(android.os.Build.VERSION.SDK_INT >= 30) {
bmp.compress(Bitmap.CompressFormat.WEBP_LOSSLESS, 80, image)
}else{
bmp.compress(Bitmap.CompressFormat.WEBP, 80, image)
}
In this case, the target SDK that we have defined in Android Studio does not interfere with this code?