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
Post a Comment