Created
September 24, 2023 20:45
-
-
Save HasibPrince/f533a861c1115b522f705cb38b8a367b 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