I try to code an app to write a file txt. I found a lot of things on internet but not what i'm really looking for.
String path=Environment.getExternalStorageDirectory().getAbsolutePath() + "/test.txt";
File file = new File(path);
FileOutputStream is = new FileOutputStream(file);
OutputStreamWriter osw = new OutputStreamWriter(is);
Writer w = new BufferedWriter(osw);
w.write("Je cree le fichier essai.txt");
w.close();
} catch (IOException e) {
Log.i("Info", "Problem writing to the file statsTest.txt");
}
Here is my code, i don't understand why the file is not created. I want to create the file on the storage of my phone and not as a hidden file of the application (So not the mode context Private).