File save
Následující ukázku je dobré mít ještě v try bloku a odchytávat např. FileNotFoundException.
String root = Environment.getExternalStorageDirectory().getPath(); //ziska "root" v zařízení
String url = root+"soubor.txt";
String textProZapis = "Text pro zápist do souboru";
File soubor = new File(url);
if (!soubor.exists()) { //neexistuje li soubor vytvoř ho
try {
soubor.createNewFile();
} catch (IOException e) {
Log.e("File Error","Problem s vytvorenim noveho souboru");
}
} OutputStream out = new FileOutputStream(soubor);
byte [] buffer = textProZapis.getBytes(); out.write(buffer);
out.close();