Created
March 29, 2019 17:52
-
-
Save traendy/0707d2a6c4f670915cd94ec9c795c7c1 to your computer and use it in GitHub Desktop.
Method to create an image file on an Android device.
This file contains 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 createImageFile(filename: String): File? { | |
val storageDir: File? = getExternalFilesDir(Environment.DIRECTORY_PICTURES) | |
return File.createTempFile( | |
filename, /* name */ | |
null, /* suffix can be null */ | |
storageDir /* directory */ | |
).apply { | |
// Save a file: path for use with ACTION_VIEW intents | |
currentPhotoPath = absolutePath | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment