I'm trying to create a file and folder on my internal storage
in manifest i have
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
these permissions.
fun test(view: View) {
try {
val myObj = File("filename.txt")
if (myObj.createNewFile()) {
println("File created: " + myObj.name)
} else {
println("File already exists.")
}
} catch (e: IOException) {
println("An error occurred.")
e.printStackTrace()
}
}
}
i got this
An error occurred.
java.io.IOException: Read-only file system
i tried so many other thing from javatpoint to official java and kotlin tutorials. but none worked