Before I was using MVVM architecture and Kotlin I done it like this in Java.
I am passing image Uri to Bitmap
Java code:
Bitmap actualImage1 = BitmapFactory.decodeStream(getContentResolver().openInputStream(mImageUri));
ByteArrayOutputStream baos = new ByteArrayOutputStream();
actualImage1.compress(Bitmap.CompressFormat.JPEG, 30, baos);
byte[] finalImage = baos.toByteArray();
getContentResolver()
is not recognized by Kotlin.
How to write this in Kotlin, again I have image uri that I want to pass to Bitmap