I'm using the below code to rename a file in Android:
File source = new File(SOURCE_PATH);
File destination = new File(DESTINATION_PATH);
if (!destination.exists()) {
source.renameTo(destination);
}
The problem is after renaming the file, there is still a file with the old name in the source folder containing 0 bytes.
I added the lines below to delete the file:
if (source.exists()) {
source.delete();
}
But the result stays the same. What should I do?