Can anyone give code for voice recorder as an application on android phone?

gowtham picture gowtham · May 10, 2010 · Viewed 27.4k times · Source

I want to develop an application on android phone regarding voice recorder. I have to record a sound for about 30 seconds and then stop and save the recorded sound in gallery. Can anyone post the code if you have please?

Answer

Dave Webb picture Dave Webb · May 10, 2010

There is an example of how to do audio capture using MediaRecorder in the Android Developer Documentation.

I would recommend saving the files on the SD Card and then have your gallery code check the SD card to see which files to display. You can get the directory of the SD Card using the Environment.getExternalStorageDirectory() method. It would be best to save your files in a subdirectory of the SD Card root directory.

Make sure you give your applications the Permissions it will need. At the very least it will need RECORD_AUDIO and WRITE_EXTERNAL_STORAGE.