문제

Actually, I want to record the audio and allow the user to playback it(before saving) and after that prompt the user to give a particular name to the file for saving in to the memory(external storage).

Currently, I am able to record and playback the audio file(with the help of MediaRecorder and MediaPlayer), but unable to save it with some different name. So, I want to copy the content of recorded audio file to another file(empty) with user specified name.

Any help or guidance will be well appreciated.

도움이 되었습니까?

해결책

Try this

File dir = Environment.getExternalStorageDirectory();
if(dir.exist()){
    File from = new File(dir,"from.mp4");
    File to = new File(dir,"to.mp4");
     if(from.exist())
        from.renameTo(to);
}
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top