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)
{

}
4

2 回答 2

0

它通常在“data/data/package.name”下

于 2013-04-08T23:12:53.570 回答
0

1.对于您所做的,它在您当前的工作目录中。

2.要获取文件的路径,请使用getFileStreamPath("samplefile.txt");

SDK Doc提到了这一点:

返回文件系统上存储使用 openFileOutput(String, int) 创建的文件的绝对路径。

于 2012-07-22T13:45:36.813 回答