android - want to store files of specific type in a ArrayList<File> and then want to delete them permanently from sd-card -


it not deleting file when use "deletefile(string);"

arraylist<string> record=new arraylist<string>(); { //searching files , storing in in record }  { //delete files stored in record permanently on click of button  } 

try below code:

file sfile = new file(file.getabsolutepath()); file mkdir = new file("/root/video"); mkdir.mkdir();  file dfile = new file(mkdir.getabsolutepath() + "/" +  sfile.getname());  try {     if (!dfile.exists())         dfile.createnewfile();     else         dfile.delete(); } catch (ioexception e1) {     e1.printstacktrace(); } 

you have store full file path in arraylist , use path


Comments

Popular posts from this blog

android - MPAndroidChart - How to add Annotations or images to the chart -

javascript - Add class to another page attribute using URL id - Jquery -

firefox - Where is 'webgl.osmesalib' parameter? -