Created
February 8, 2019 08:42
-
-
Save sergeykomlach/39c9d843633f3c580ccba62c5618009c to your computer and use it in GitHub Desktop.
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
File dir = Environment.getExternalStoragePublicDirectory( | |
Environment.DIRECTORY_DOWNLOADS); | |
if (!dir.exists() && !dir.mkdirs()) { | |
dir = Environment.getExternalStorageDirectory(); | |
if (!dir.exists() && !dir.mkdirs()) { | |
throw new IOException(dir.getName() + " permissions denied"); | |
} | |
} | |
String name = "file_"; | |
SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd_HHmmss"); | |
name = name.concat(sdf.format(Calendar.getInstance().getTime())).concat(".bin"); | |
File dst = new File(dir, name); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment