Created
June 10, 2020 17:54
-
-
Save mdavalos1993/603fda13221bbcdc152d90b8d63758a9 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 storeImage(bitmap: Bitmap, fileName: String){ | |
val wrapper = ContextWrapper(context) | |
var file = wrapper.getDir("images", Context.MODE_PRIVATE) | |
file = File(file, "${fileName}.jpg") | |
try{ | |
val stream: OutputStream = FileOutputStream(file) | |
bitmap.compress(Bitmap.CompressFormat.JPEG, 100, stream) | |
stream.flush() | |
stream.close() | |
imageUri = Uri.parse(file.absolutePath) | |
} | |
catch (e: IOException){ | |
e.printStackTrace() | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment