Tuesday, December 13, 2011

Simple Android Audio record Example Android


public class AudioRecorder {
  final MediaRecorder recorder = new MediaRecorder();
  public void start() throws IOException {
  
    recorder.setAudioSource(MediaRecorder.AudioSource.MIC);
    recorder.setOutputFormat(MediaRecorder.OutputFormat.THREE_GPP);
    recorder.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB);
    recorder.setOutputFile(sdCardPath+"/xyz.3gp");
    recorder.prepare();
    recorder.start();
  }

 
  public void stop() throws IOException {
    recorder.stop();
    recorder.release();
  }

}

2 comments:

  1. sdCardPath cannot be resolved to a variable

    ReplyDelete
  2. Use sdCardPath = "/sdcard/external_sd/" or String url = Environment.getExternalStorageDirectory();

    ReplyDelete

content -->