<!--Create and delete files in SDcard permissions --
<uses-permission android:name= "Android.permission.MOUNT_UNMOUNT_FILESYSTEMS"/>
<!--write data to SDcard permissions --
<uses-permission android:name= "Android.permission.WRITE_EXTERNAL_STORAGE"/>
Delete a file
FileName = "/sdcard/myimage/" + image;
Remove the SD card folder
<span style= "white-space:pre" ></span>//remove SD card file <span style= "White-space:pre" ></span> public static void DeleteFile (file file) {<span style= "White-space:pre" ></span>if ( Environment.getexternalstoragestate (). Equals (environment.media_mounted)) {<span style= "White-space:pre" > </span>if (File.exists ()) {<span style= "White-space:pre" ></span>if (File.isfile ()) {<span style = "White-space:pre" ></span>file.delete (); <span style= "White-space:pre" ></span>}<span Style= "White-space:pre" ></span>//if it is a directory <span style= "White-space:pre" ></span>else if ( File.isdirectory ()) {<span style= "white-space:pre" ></span>//declaration directory for all Files Files[];<span style= " White-space:pre "></span>file files[] = File.listfiles (); <span style=" White-space:pre "></span> for (int i = 0; i < files.length; i++) {//Traverse directory All Files <span style= "White-space:pre" ></span>deletefile (Files [i]); //Use this method to iterate over each file <span style= "White-space:pre" ></span>}<span style= "White-space:pre" ></span >}<span style= "White-space:pre" ></span>file.delete (); <span style= "White-space:pre" ></ Span>}<span style= "White-space:pre" ></span>}<span style= "White-space:pre" ></SPAN>}
SD Card write: http://blog.csdn.net/zhaoyazhi2129/article/details/8994295
Android Delete SD card file