private fun writeFileOnInternalStorage(mcoContext: Context, sFileName: String?, sBody: String?) {
val dir = File(mcoContext.getFilesDir(), "mydir")
if (!dir.exists()) {
dir.mkdir()
}
try {
val gpxfile = File(dir, sFileName)
val writer = FileWriter(gpxfile)
writer.append(sBody)
writer.flush()
writer.close()
} catch (e: Exception) {
e.printStackTrace()
}
}
Write file on internal storage
- Details
- Written by: Stanko Milosev
- Category: Android
- Hits: 1253
Method to write file: