Pergunta

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.

Foi útil?

Solução

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);
}
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top