简体   繁体   中英

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

Add to your code a log statement, to print out the Context.getFilesDir() from any method of an Activity:

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

Refer to Android documentation: Android Context docs...

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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