关于JAVA File类 创建文件、文件夹,No such file or directory 错误
这几天做Android应用程序,涉及到一个创建文件、文件夹的操作!开始马大哈,写成了如下的程序。
public static String getFolderPath ( String userId ){String status = Environment.getExternalStorageState();String path = null;File file = null;if (status.equals(Environment.MEDIA_MOUNTED)){path = ExternalStorage_PATH + userId;} else{path = DATA_PATH + userId;}file = new File(path);if (!file.exists()){file.mkdirs();}return path;} 直接搞定,创建完成,哎,这个都是粗心惹的祸啊!童鞋们,也谨记,细心啊