I made an android app which writes to a file in an activity.
The writing to file, it works like a charm:
FileOutputStream fOut = openFileOutput("myfeeds.txt",
MODE_WORLD_READABLE);
OutputStreamWriter osw = new OutputStreamWriter(fOut);
osw.write(file);
osw.flush();
osw.close();
But when I want to read it back from another acivity it can’t find the file…the file exists I checked with DDMS file explorer.
Reading file contents:
FileInputStream fis = new FileInputStream("myfeeds.txt"); // cant find file
InputSource input = new InputSource(fis);
xr.setContentHandler(this);
xr.parse(input);
What is the correct location to my file?
Use
openFileInputto get FileInputStream object for those files which are written using openFileOutputStreamuse the following code