求教,請大神幫幫忙。如何在文件系統根目錄創建目錄和文件,字數字數字數字數字數字數字數字數字數字數字數字數字數
String status = Environment.getExternalStorageState();
if (status.equals(Environment.MEDIA_MOUNTED)) {
String main= Environment.getExternalStorageDirectory().getPath()+File.separator+"hello";
File destDir = new File(main);
if (!destDir.exists()) {
destDir.mkdirs();//在根創建了文件夾hello
}
destDir.mkdirs();
String toFile = main+File.separator+"test.txt"
java.io.FileOutputStream fosto = new FileOutputStream(toFile);//創建test.text空文件
//fosto.write(bt, 0, c);//寫內容
//void java.io.FileOutputStream.write(byte[] buffer, int byteOffset, int byteCount) throws IOException//說明
//....
}