0

I'm trying to save an xml file to a USB device connected to an android device via USB OTG, and I'm getting this exception:

javax.xml transform.TransformerException: java.io.FileNotFoundException: /mnt/usb/filename.xml (Permission denied)

/mnt/usb is the path to the USB device.

If I change the path to something local on the device, everything works.

I read here and tried changing this line:

StreamResult result = new StreamResult(new File( PATH, filename ));

to:

File myfile = new File( PATH, filename );
StreamResult result = new StreamResult(myfile.toURI().getPath());

But the same exception occurred.

On the USB device itself, I can't find any permission configurations, but I can create files in it when connected to PC.

Community
  • 1
  • 1
Alaa M.
  • 4,961
  • 10
  • 54
  • 95

0 Answers0