I’m trying to open up an xml file to parse it, but I am getting stopped trying to open the file. My code is:
try {
return new FileInputStream(location);
} catch (FileNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
return null;
}
where location is a String passed into the function. Upon running my code, I get:
java.io.FileNotFoundException: /C:/Users/Seth/AndroidWorkspace/UCoupon/res/xml/information.xml (No such file or directory)
I gave the full file path, and I havn’t mispelled anything. What am I doing wrong?
you can’t read files on your pc from your device or emulator.
see here for an introduction to Data Storage and here for Accessing Resources (that is probably what you’re interested in, as you’re trying to access
res/xml/)