基本上,我需要以每次创建新文件时都要执行检查的方式进行编码,如果文件已经存在,则下一个文件的名称与前一个文件一样,但也将递增的签名号隐含为区分而不是替换。
String folder_main = "Recordings"; //Creates folder path
File file = new File(Environment.getExternalStorageDirectory(), folder_main);
file.mkdirs();
mediaFileName = Environment.getExternalStorageDirectory().getAbsolutePath();
mediaFileName += "Recordings/recorded_audio.mp3"; //Specifies file path on the device and the name of the created audio file
我们将如何修改此代码?