I create this method to create a new file and write a file to a folder called "MPS 3000". But when I run my application, I can't see anything changed in my android device. Is there anything wrong? Thanks.
public void WriteToFile(String sBody) {
//SimpleDateFormat formatter = new SimpleDateFormat("yyyy.MM.dd G 'at' HH:mm:ss z");
//Date present = new Date();
String fileName = "mps.txt";
try {
File root = new File(Environment.getExternalStorageDirectory(), "MPS3000");
if (!root.exists()) {
root.mkdirs();
}
File mpsfile = new File(root, fileName);
FileWriter writer = new FileWriter(mpsfile, true);
writer.append(sBody + "\n\n");
writer.flush();
writer.close();
Toast.makeText(this, "Saved...", Toast.LENGTH_SHORT).show();
} catch (IOException e) {
e.printStackTrace();
}
}