In your code:
Shouldn’t it be :
File from = new File(directory, currentFileName);
instead of
File from = new File(directory, "currentFileName");
For safety,
Use the File.renameTo() . But check for directory existence before renaming it!
File dir = Environment.getExternalStorageDirectory();
if(dir.exists()){
File from = new File(dir,"from.mp4");
File to = new File(dir,"to.mp4");
if(from.exists())
from.renameTo(to);
}
Refer:
http://developer.android.com/reference/java/io/File.html#renameTo%28java.io.File%29