Storage-Environment


建立文件目录:

if (Environment.getExternalStorageState().equals(

Environment.MEDIA_MOUNTED)) {
String fileStr = Environment.getExternalStorageDirectory().getAbsolutePath() + File.separator
+ Shared.me.getPackageName() + "/pin55/" +
System.currentTimeMillis() + ".jpg";
File file = new File(fileStr);
File dirs = new File(file.getParent());
if (!dirs.exists()) {
dirs.mkdirs();
}
try {
file.createNewFile();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}

你可能感兴趣的:(android)