Created
December 15, 2018 07:22
-
-
Save pjwelcome/a9eba19654e8a9353507cca447b5caee to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private fun getBytesFromBitmap(bitmap: Bitmap): ByteArray { | |
val stream = ByteArrayOutputStream() | |
bitmap.compress(CompressFormat.JPEG, 70, stream) | |
return stream.toByteArray() | |
} | |
val bitmap = MediaStore.Images.Media.getBitmap(this.contentResolver, contentURI) | |
Toast.makeText(this@MainActivity, "Image Saved!", Toast.LENGTH_SHORT).show() | |
imageView.setImageBitmap(bitmap) | |
val imgString = Base64.encodeToString(getBytesFromBitmap(bitmap),Base64.NO_WRAP) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment