Androïd ; Playing with storage info
public void test(){
try {
File file = Environment.getExternalStorageDirectory();
String strFile = file.getPath();
Log.d("wififun", "ext storage dir =" + strFile);
Log.d("wififun", "ext storage length =" + file.length());
Log.d("wififun", "ext storage total space =" + file.getTotalSpace()/1024/1024 + "mb");
Log.d("wififun", "ext storage free space =" + file.getFreeSpace()/1024/1024 + "mb");
File myFile = new File(strFile + "/wififun.log");
Log.d("wififun","can write new log file= " + myFile.canWrite());
Log.d("wififun","exists new log file= "+myFile.exists());
Log.d("wififun","size new log file= "+myFile.length());
FileOutputStream fileOutputStream = new FileOutputStream(myFile);
String str = "message debug de test d'écriture dans log file";
fileOutputStream.write(str.getBytes());
fileOutputStream.close();
} catch (Exception e) {
log("Exception:test:"+e.getMessage());
}
}