简体   繁体   中英

how to know the exact reason why FileWriter file = new FileWriter('…', append); failed?

when FileWriter file = new FileWriter(' /data/data/com.myapp.app/files/locationservices.json', true/*append*/); return me the error :

java.io.FileNotFoundException: /data/data/com.myapp.app/files/locationservices.json (No such file or directory)

how to know exactly why it's failed to create the file?

Try this one

File file = new File(uri);
file.mkdirs()
FileWriter fileWriter = new FileWriter(file , true)

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