My Question is how to move file not copy by just changing the path of file system level
in android file.nenameTo(newpath); this method works only when I have path like this
File f = new File(/storage/Folder1/Folder2/image.png);
File newfile = new File((/storage/Folder1/Folder3/image.png);
f.renameTo(newfile); // this method returns true
it works but when more then one parent folder change then it's not working
File f = new File(/storage/Folder1/Folder2/image.png);
File newfile = new File((/storage/Folder3/Folder4/image.png);
f.renameTo(newfile); // this method returns false
the following case also not work
File f = new File(/storage/Folder1/Folder2/image.png);
File newfile = new File((/storage/Folder3/image.png);
f.renameTo(newfile); // this method returns false
I want to move file like above
sorry for my English
You can only rename a file in Android if the src and dst are on the same mount point. You don't specify either way. Please consider using Files.move instead to avoid this potential issue and others.