I want to store the created file of this code somewhere in my sdcard (i.e. sdcard/myfiles/file/)
final String TESTSTRING = new String("Hello Android");
FileOutputStream fOut = openFileOutput("samplefile.txt", MODE_WORLD_READABLE);
OutputStreamWriter osw = new OutputStreamWriter(fOut);
osw.write(TESTSTRING);
osw.flush();
osw.close();
I’m new to java and android dev, many thanks for any help! 🙂
Use following code to write file in SDCard
Environment.getExternalStorageDirectory()class returns the path of your sdcard.