1. Are you ready for the Galaxy S20? Here is everything we know so far!

Android studio rename video file in internal storage

Discussion in 'Android Development' started by parthag, Jan 14, 2022 at 10:17 AM.

  1. parthag

    parthag Lurker
    Thread Starter

    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
     



    1. Download the Forums for Android™ app!


      Download

       
Loading...
Similar Threads - Android studio rename
  1. workbench
    Replies:
    1
    Views:
    195
  2. thkl
    Replies:
    2
    Views:
    196
  3. brentc
    Replies:
    1
    Views:
    267
  4. brentc
    Replies:
    2
    Views:
    276
  5. hex1364
    Replies:
    0
    Views:
    285
  6. grellocj
    Replies:
    3
    Views:
    491
  7. Castino
    Replies:
    1
    Views:
    401
  8. PascalAuger
    Replies:
    16
    Views:
    1,112
  9. Dayle Swensen
    Replies:
    7
    Views:
    1,244
  10. normvcr
    Replies:
    0
    Views:
    457

Share This Page

Loading...