1

In the code below I created a new text file. I am having trouble locating where this file is and I need the actual file path of this file so I can upload to a ftp server. Can someone please help me ?

Note: I am testing this app on an actual phone and I would like to physically find the file.

Thanks !

try
{
    final String testString = new String("Hello");
    FileOutputStream fOut = openFileOutput("samplefile.txt", MODE_WORLD_READABLE);
    OutputStreamWriter osw = new OutputStreamWriter(fOut); 

    osw.write(testString);
    osw.flush();
    osw.close();
}
catch(IOException ex)
{

}
1

2 Answers 2

0

1. For what you have done, its in your current working directory.

2. For getting the path to the file use the getFileStreamPath("samplefile.txt");

The SDK Doc metions this:

Returns the absolute path on the filesystem where a file created with openFileOutput(String, int) is stored.

0

It is usually under "data/data/package.name"

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.