SAVE FILE SD CARD:

agosto 17, 2018 doido 2.0 0 Comments

try { java.io.File myNote = new java.io.File(getExternalCacheDir() + "/" +edittext1.getText() +
".txt"); myNote.createNewFile(); java.io.FileOutputStream fOut = new
java.io.FileOutputStream(myNote);
java.io.OutputStreamWriter myOutWriter = new java.io.OutputStreamWriter(fOut);
myOutWriter.append(edittext2.getText()); myOutWriter.close(); fOut.close();
Toast.makeText(getBaseContext(), "Salvo em /sdcard/Android/data/br.salvarnotas/cache/"
+edittext1.getText() + ".txt", Toast.LENGTH_SHORT).show();
}catch (Exception e) { Toast.makeText(getBaseContext(), e.getMessage(),
Toast.LENGTH_SHORT).show(); }

0 Comments: