Created
September 4, 2020 17:11
-
-
Save Audhil/d7c07009a016c64a35c342147be5001b to your computer and use it in GitHub Desktop.
handy func to write content to internal storage file - useful to print logs, when it gets truncated by logcat!
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
private fun writeToFile(data: String, context: Context) { | |
try { | |
val outputStreamWriter = OutputStreamWriter(context.openFileOutput("config.txt", Context.MODE_PRIVATE)) | |
outputStreamWriter.write(data) | |
outputStreamWriter.close() | |
} catch (e: IOException) { | |
showELog("File write failed: $e") | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment