parthag

Lurker
Jan 10, 2022
1
0
15
Hi All,
I am a complete newbie to android development. I have created an app which takes a 5 second video and stored it in the phones internal storage. The path is shown as "/storage/emulated/0/DCIM/camera" . However I cannot rename the file to a customized file name through code. I am doing the following in my code (assuming filename is the String containing the .mp4 file name:

File dir=new File ("/storage/emulated/0/DCIM/Camera/");
File fromfile=new File (dir,filename);
File tofile=new File(dir,"myname.mp4");
fromfile.renameTo(tofile);

What am I doing wrong? Any help will be appreciated
Thanks
 
Forgot your password?
or Log in using