Created
October 23, 2021 21:44
-
-
Save towcar/cc527c682ad5c763e240ba8337c19a54 to your computer and use it in GitHub Desktop.
Image Picker Activity createImageFile()
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 File createImageFile() throws IOException { | |
// Create an image file name | |
String timeStamp = new SimpleDateFormat("yyyyMMdd_HHmmss").format(new Date()); | |
String imageFileName = "JPEG_" + timeStamp + "_"; | |
File storageDir = getExternalFilesDir(Environment.DIRECTORY_PICTURES); | |
File image = File.createTempFile( | |
imageFileName, /* prefix */ | |
".jpg", /* suffix */ | |
storageDir /* directory */ | |
); | |
// Save a file: path for use with ACTION_VIEW intents | |
//currentPhotoPath = image.getAbsolutePath(); | |
return image; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment