I want a button to be clicked that saves an image view to the android devices gallery in kotlin. I have this
val image = findViewById<ImageView>(R.id.QRImage)
I want a button to be clicked that saves an image view to the android devices gallery in kotlin. I have this
val image = findViewById<ImageView>(R.id.QRImage)
2
Answers
You can convert your image to bitmap first like the code below:
Then save the bitmap where you want like the code below:
or save it directly like the code below:
I think, this should work:
MediaStore.Images.Media.insertImage(getContentResolver(), yourBitmap, yourTitle , yourDescription);
Also, it is written in this question: android – save image into gallery