title: Record audio in AMR file format
body: <p>I wan to record audio in AMR file format. I am currently using bellow code to record audio:</p>
  
  <pre><code>outputFile = Environment.getExternalStorageDirectory().getAbsolutePath() + "Sample.3gp";
  
  myRecorder = new MediaRecorder();
  myRecorder.setAudioSource(MediaRecorder.AudioSource.MIC);
  myRecorder.setOutputFormat(MediaRecorder.OutputFormat.THREE_GPP);
  myRecorder.setAudioEncoder(MediaRecorder.OutputFormat.AMR_NB);
  myRecorder.setOutputFile(outputFile);
  </code></pre>
  
  <p>But it generates .3gp file. How can I get .amr file?
  <strong>Changing outputfile to Sample.amr works. But is it a correct way?</strong> Please help</p>
  
  <p>EDIT
  <strong>ITS SOLVED NOW</strong></p>
  
  <p>It was my Silly Mistake: I used <code>myRecorder.setAudioEncoder(MediaRecorder.OutputFormat.AMR_NB);</code></p>
  
  <p>It should be-</p>
  
  <pre><code>myRecorder.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB);
  </code></pre>
  
  <p>So bellow code is working for Recording in AMR format:</p>
  
  <pre><code>outputFile = Environment.getExternalStorageDirectory().getAbsolutePath() + "Sample.amr";
  
      myRecorder = new MediaRecorder();
      myRecorder.setAudioSource(MediaRecorder.AudioSource.MIC);
      myRecorder.setOutputFormat(MediaRecorder.OutputFormat.AMR_NB);
      myRecorder.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB);
      myRecorder.setOutputFile(outputFile);
  </code></pre>