In KOTLIN, all alternatives have been tested but a bitmap image could not be saved to an External Storage
If I use:
MediaStore.Images.Media.insertImage(this.contentResolver, file.absolutePath, file.name, file.name)
Then, I got "insertImage is deprecated in Java"
If I use:
values.put(MediaStore.Images.Media.DATA, file.absolutePath) context.contentResolver.insert(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, values)
Then, I got " DATA is deprecated in Java "
Also
Environment.getExternalStorageDirectory() is deprecated
How to solve this problem?
Use insert() to obtain an uri. Open an outputstream for the uri and compress your bitmap to it. Android Q?