Skip to content

Instantly share code, notes, and snippets.

@Audhil
Created September 4, 2020 17:11
Show Gist options
  • Save Audhil/d7c07009a016c64a35c342147be5001b to your computer and use it in GitHub Desktop.
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!
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