简体   繁体   English

我找不到我的应用程序创建的文件

[英]I can't find the file that my app creates

Hi i'm creating a file with strings with this code 嗨,我正在使用此代码创建包含字符串的文件

public void writeData(String data){
try {
    FileOutputStream fOut = openFileOutput("chaves.dat" , MODE_APPEND);
OutputStreamWriter osw = new OutputStreamWriter(fOut);
        osw.write(data);
        osw.flush();
        osw.close();

    } catch (FileNotFoundException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    } catch (IOException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
    }

I can read the file with another method and use the string that i saved there, so far so good, my problem is that I CANT FIND THE FILE, i've looked everywhere!! 我可以用另一种方法读取文件并使用保存在其中的字符串,到目前为止,我的问题是我无法找到文件,我到处都看过!! using the DDMS tool i've been in data/data/"my app folder" (that is allways empty) i'm just wondering if you guys have any clue on where it is, i need to delete it and i cant, and its anoying Thank you very much 使用DDMS工具,我一直在数据/数据/“我的应用程序文件夹”(一直为空)中,我只是想知道你们是否对它的位置有任何了解,我需要删除它,我不能,并且非常烦人

Add to your code a log statement, to print out the Context.getFilesDir() from any method of an Activity: 在您的代码中添加一条日志语句,以从Activity的任何方法中打印出Context.getFilesDir():

Log.i("MyApp", "My app files location = " + getFilesDir());

Refer to Android documentation: Android Context docs... 请参阅Android文档: Android Context文档...

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM