在Android文件写的权限权限、文件、Android

2023-09-07 21:59:09 作者:誓言的真名叫失言

我想通过使用下列中的文件写:

i want to write in a file by using the following:

                BufferedWriter buf = new BufferedWriter(new FileWriter("test2"));
                        buf.write(mytext);
                        buf.close();

但我得到这个消息(文件test2的只读)

but i got this message (file test2 read only)

我怎样才能写权限

推荐答案

你有没有在你的Andr​​oidManifest.xml文件中得到这个?

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