android, How to rename a file?

前端 未结 9 2108
Happy的楠姐
Happy的楠姐 2020-11-28 09:58

In my application, I need to record video. Before start of recording in I\'m assigning a name and directory to it. After recording is finished user has ability to rename his

9条回答
  •  暖寄归人
    2020-11-28 10:34

    The problem is in this line,

    File from = new File(directory, "currentFileName");
    

    Here currentFileName is actually a String you dont have to use "

    try it this way,

    File from      = new File(directory, currentFileName  );
                                        ^               ^         //You dont need quotes
    

提交回复
热议问题