Created
February 24, 2018 10:57
-
-
Save Tarelochkin/034de00af301e0eeca15a5b375b6b269 to your computer and use it in GitHub Desktop.
Create a file with a filename containg current date
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
static File createTempImageFile(Context context) throws IOException { | |
String timeStamp = new SimpleDateFormat("yyyyMMdd_HHmmss", | |
Locale.getDefault()).format(new Date()); | |
String imageFileName = "JPEG_" + timeStamp + "_"; | |
File storageDir = context.getExternalCacheDir(); | |
return File.createTempFile( | |
imageFileName, /* prefix */ | |
".jpg", /* suffix */ | |
storageDir /* directory */ | |
); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment