Luis Almeida
Luis Almeida

Reputation: 59

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

Upvotes: 0

Views: 47

Answers (1)

fsanti
fsanti

Reputation: 26

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...

Upvotes: 1

Related Questions