-
-
Save virendersran01/566c4319a85a42a3cc06b119f9eafb3a to your computer and use it in GitHub Desktop.
Usage of old storage api
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
val filename = "myFile.txt" | |
val content = "Hello, World!" | |
val documentsDir = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOCUMENTS) | |
val file = File(documentsDir, filename) | |
file.outputStream().use { outputStream -> | |
outputStream.write(content.toByteArray()) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment