I need for my android application to save an xml file into the external cache with a file name which contains space.
DOMSource source = new DOMSource(doc);
StreamResult result = new StreamResult(new File(activity
.getExternalCacheDir().getAbsolutePath()
+ "/Local storage.xml"));
transformer.transform(source, result);
When I browse manually into my file directory I find this file : "Local%20storage.xml".
So after when I try to read it with
File localStorageXmlFile = new File(activity.getExternalCacheDir()
.getAbsolutePath()
+ "/Local storage.xml");
But I have a FileNotFoundException because the file "Local storage.xml" can't be found on my device.
Any ideas to solve this? Seb
new File(activity.getExternalCacheDir(), "Local storage.xml")
- it will do that for you. No idea what causes your problem though – Circumnavigate