Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to add Write to File Permission on Android

Tags:

java

android

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?

like image 215
m7m Avatar asked Apr 28 '11 14:04

m7m


People also ask

How do you get read and write permissions in Android?

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.

How do I give a read and write permission to a file manager?

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.


1 Answers

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

like image 147
NotACleverMan Avatar answered Sep 22 '22 12:09

NotACleverMan