Hi All,

I am trying to write a recorder app (android 1.6).

I have used the following code:

 recorder.setAudioSource(MediaRecorder.AudioSource.VOICE_CALL);
recorder.setOutputFormat(MediaRecorder.OutputFormat.THREE_GPP);
recorder.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB);
 recorder.setOutputFile("/sdcard/record.3gp");
                         try {
                                        recorder.prepare();


                                } catch (IllegalStateException e) {
                                        // TODO Auto-generated catch block
                                        e.printStackTrace();
                                } catch (IOException e) {
                                        // TODO Auto-generated catch block
                                        e.printStackTrace();
                                }
                         recorder.start();

I am getting the following exception.

Can any one please help to solve this?

E/AndroidRuntime( 1437): Uncaught handler: thread main exiting due to
uncaught exception
E/AndroidRuntime( 1437): java.lang.RuntimeException: start failed.
E/AndroidRuntime( 1437):     at android.media.MediaRecorder.start
(Native Method)
E/AndroidRuntime( 1437):     at
com.Recorder.MyRecorder.PrepareAudioRecorder(MyRecorder.java:241)
E/AndroidRuntime( 1437):     at com.Recorder.MyRecorder.HandleEvent
(MyRecorder.java:288)
E/AndroidRuntime( 1437):     at
com.Recorder.RecorderForMyApp.HandleAudioRecorderEvent
(RecorderForMyApp.java:327)
E/AndroidRuntime( 1437):     at com.Recorder.RecorderForMyApp.access$1
(RecorderForMyApp.java:322)
E/AndroidRuntime( 1437):     at com.Recorder.RecorderForMyApp$2.onClick
(RecorderForMyApp.java:170)
E/AndroidRuntime( 1437):     at android.view.View.performClick
(View.java:2344)
E/AndroidRuntime( 1437):     at android.view.View.onTouchEvent
(View.java:4133)
E/AndroidRuntime( 1437):     at android.widget.TextView.onTouchEvent
(TextView.java:6504)
E/AndroidRuntime( 1437):     at android.view.View.dispatchTouchEvent
(View.java:3672)
E/AndroidRuntime( 1437):     at
android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:882)
E/AndroidRuntime( 1437):     at
android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:882)
E/AndroidRuntime( 1437):     at
android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:882)
E/AndroidRuntime( 1437):     at
android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:882)
E/AndroidRuntime( 1437):     at
android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:882)
E/AndroidRuntime( 1437):     at
android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:882)
E/AndroidRuntime( 1437):     at
com.android.internal.policy.impl.PhoneWindow
$DecorView.superDispatchTouchEvent(PhoneWindow.java:1712)
E/AndroidRuntime( 1437):     at
com.android.internal.policy.impl.PhoneWindow.superDispatchTouchEvent
(PhoneWindow.java:1202)
E/AndroidRuntime( 1437):     at android.app.Activity.dispatchTouchEvent
(Activity.java:1987)
E/AndroidRuntime( 1437):     at
com.android.internal.policy.impl.PhoneWindow
$DecorView.dispatchTouchEvent(PhoneWindow.java:1696)
E/AndroidRuntime( 1437):     at android.view.ViewRoot.handleMessage
(ViewRoot.java:1658)
E/AndroidRuntime( 1437):     at android.os.Handler.dispatchMessage
(Handler.java:99)
E/AndroidRuntime( 1437):     at android.os.Looper.loop(Looper.java:
123)
E/AndroidRuntime( 1437):     at android.app.ActivityThread.main
(ActivityThread.java:4203)
E/AndroidRuntime( 1437):     at java.lang.reflect.Method.invokeNative
(Native Method)
E/AndroidRuntime( 1437):     at java.lang.reflect.Method.invoke
(Method.java:521)
E/AndroidRuntime( 1437):     at com.android.internal.os.ZygoteInit
$MethodAndArgsCaller.run(ZygoteInit.java:791)
E/AndroidRuntime( 1437):     at com.android.internal.os.ZygoteInit.main
(ZygoteInit.java:549)
E/AndroidRuntime( 1437):     at dalvik.system.NativeStart.main(Native
Method)

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to