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

Record audio sound in android studio

Discussion in 'Android Development' started by Syeda Quratulain, Aug 5, 2020.

  1. Syeda Quratulain

    Thread Starter

    I am following this tutorial () to record and play sounds. but having the problem in saving sound to folder. everything is working fine but when i check the folder where i saved the file then it is empty.

    String recordPath = getActivity().getExternalFilesDir("/").getAbsolutePath();
    SimpleDateFormat formatter = new SimpleDateFormat("yyyy_MM_dd_hh_mm_ss", Locale.CANADA);
    Date now = new Date();
    recordFile = "Recording_"+formatter.format(now)+".3gp";
    filenameText.setText("Recording filename : "+recordFile);
    Toast.makeText(getActivity().getApplicationContext(),recordPath+"/"+recordFile,Toast.LENGTH_LONG).show();

    mediaRecorder = new MediaRecorder();
    mediaRecorder.setAudioSource(MediaRecorder.AudioSource.MIC);
    mediaRecorder.setOutputFormat(MediaRecorder.OutputFormat.THREE_GPP);
    mediaRecorder.setOutputFile(recordPath+"/"+recordFile);



    kindly help me out of it or suggest any other way to record audio files.
     


  2. Unforgiven

    Unforgiven ...eschew obfuscation...
    Moderator

    Development thread moved to the dev area for better exposure. Good luck!! :)
     
    ocnbrze likes this.
Loading...

Share This Page

Loading...