public static final String TEMP_PHOTO_FILE_NAME = "temp_photo.jpg";
private static String mSdRootPath = Environment.getExternalStorageDirectory().getPath();
/**
* 删除SD卡或者手机的缓存图片和文件夹
*/
public void deleteFile() {
Log.i("INFO", mSdRootPath+"/"+TEMP_PHOTO_FILE_NAME+"========================");
File dirFile = new File(mSdRootPath+"/"+TEMP_PHOTO_FILE_NAME);
if(! dirFile.exists()){
return;
}
if (dirFile.isDirectory()) {
String[] children = dirFile.list();
for (int i = 0; i < children.length; i++) {
new File(dirFile, children[i]).delete();
}
} dirFile.delete();
}
版权声明:本文博客原创文章。博客,未经同意,不得转载。