Media recorder doesnt work
<pre><code>   OnClickListener startRecord = new OnClickListener() {
      public void onClick(View v) {

      String audiodir = new String(Environment.getExternalStorageDirectory() + File.separator +   "Test" + File.separator);

         while (stop_rec == false){

                SimpleDateFormat formatter = new SimpleDateFormat("yyyy_MM_dd_HH_mm_ss");
                Date now = new Date();
                String fileName = formatter.format(now) + ".raw";

                String audiopath = new String(audiodir + fileName);

                MediaRecorder recorder = new MediaRecorder();
                recorder.setAudioSource(MediaRecorder.AudioSource.MIC);
                recorder.setAudioEncoder(MediaRecorder.AudioEncoder.DEFAULT);
                recorder.setOutputFormat(MediaRecorder.OutputFormat.RAW_AMR);

                recorder.setOutputFile(audiopath);
                try {
                  recorder.prepare();
                } catch (Exception e){
                    e.printStackTrace();
                }


                 recorder.start();   // Recording is now started

                 new RecordActivity().execute(); //waiting

                 recorder.stop();
                 recorder.reset();   
                 recorder.release(); 
            }
            stop_rec = false;
        }
    };

    //@Override
    OnClickListener stopRecord = new OnClickListener() {
        public void onClick(View v) {
            stop_rec = true; //for stop recording
        }
    };`
</code></pre>

<p>Hi, my problem is on the row with recorder.setAudioSource(MediaRecorder.AudioSource.MIC) it generete some RuntimeException.  </p>

<p>More details I cant see, becouse there is another error:
"Class file editor, source not found: The source attachment does not contain the source for the file InvocationTargetException.class. ..."</p>

<p>Can anybody help me?</p>

<p>Thanks.</p>
