简体   繁体   中英

android studio java.io.filenotfoundexception Save text file

I have copy an example from developer page:

String FILENAME = "hello_file";
String string = "hello world!";
FileOutputStream fos = openFileOutput(FILENAME, Context.MODE_PRIVATE);
fos.write(string.getBytes());
fos.close();

but it says that that:

exception java.io.filenotfoundexception on : openFileOutput(FILENAME, Context.MODE_PRIVATE)

<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

In the manifest

More on: http://developer.android.com/guide/topics/security/permissions.html

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM