title: Permission problems for sound recording
body: <p>I am having a couple of problems recording sound on a device. The code I am using if from the android dev site (<a href="http://developer.android.com/reference/android/media/MediaRecorder.html" rel="nofollow">Site Link</a>) and is as follows:</p>
  
  <pre><code>    public void onClickStart(View v) throws IllegalStateException, IOException{
          startRecord();
      }
  
      public void onClickStop(View v) throws IllegalStateException, IOException{
          stopRecord();
      }
  
      private void startRecord() throws IllegalStateException, IOException{
          recorder = new MediaRecorder(); 
          recorder.setAudioSource(MediaRecorder.AudioSource.MIC);  //ok so I say audio source is the microphone, is it windows/linux microphone on the emulator? 
          recorder.setOutputFormat(MediaRecorder.OutputFormat.THREE_GPP); 
          recorder.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB); 
          recorder.setOutputFile("/sdcard/test.3gpp"); 
          recorder.prepare(); 
          recorder.start();  
      }
  
      private void stopRecord(){
          recorder.stop();
  //      recorder.release();
      }
  </code></pre>
  
  <p>With 2 buttons in the main layout which it turn both stop and start the recording (in theory that is).</p>
  
  <p>But from LogCat when trying this out on my device (really cant be bothered with trying on the emulator) I get the following errors:</p>
  
  <pre><code>Error 1:
  ERROR/MediaRecorder(14541): start called in an invalid state: 4
  java.lang.IllegalStateException: Could not execute method of the activity
  Caused by: java.lang.reflect.InvocationTargetException
  
  Error 2:
  Caused by: java.io.FileNotFoundException: /sdcard/test.3gpp (Permission denied)
  </code></pre>
  
  <p>And I also have the following permissions set in my Manifest.xml file:</p>
  
  <pre><code>&lt;uses-permission android:name="android.permission.RECORD_AUDIO" /&gt;
  &lt;uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /&gt;
  </code></pre>