Android: MIC crash (via setAudioSource)

I am developing my first application on G1 with firmware 2.2, and my code crashes on the emulator and on the phone when I try to run it.

I have the following:

public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // Prepare recorder source and type recorder = new MediaRecorder(); recorder.setAudioSource(MediaRecorder.AudioSource.MIC); 

If you try to execute recorder.setAudioSource (MediaRecorder.AudioSource.MIC), the code will be corrupted in the last line.

After several Google searches, it seems that many people have this problem, but I can not find any solutions for this!

Does anyone know why this is happening and how to fix it?

I would be very grateful,

Thanks,

Jary

+4
source share
1 answer

I found a solution, it should be:

 <uses-permission android:name="android.permission.RECORD_AUDIO"/> 
+6
source

All Articles