This is the easiest sample of how to read and write simple txt files in Kotlin for Android.
class SomeActivity: AppCompatActivity(){
fun saveAThing(thing: String){
File(this.filesDir, "things.txt").bufferedWriter().use { out ->
out.write(thing)
}
fun openThings(){
var printText = ""
File(this.filesDir, "things.txt").bufferedReader().forEachLine { line ->
printText += line
}
println(printText)
}
}