I want to write in a file by using the following:
BufferedWriter buf = new BufferedWriter(new FileWriter("test2"));
buf.write(mytext);
buf.close();
but i got this message
(file test2 read only)
How can i get the write permission?
To read and write data to external storage, the app required WRITE_EXTERNAL_STORAGE and READ_EXTERNAL_STORAGE system permission. These permissions are added to the AndroidManifest. xml file. Add these permissions just after the package name.
Step 1: Open your File Manager and navigate to the file or folder that you need to change. Step 2: Click on the name of the file or folder. Step 3: Click on the Change Permissions link in the top menu of the File Manager page. Step 4: Click on as many check boxes as you require to create the right permission.
Have you got this in your AndroidManifest.xml file?
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
Also, this link has everything you need to know about reading and writing files:
http://www.anddev.org/working_with_files-t115.html
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With