Capturing Video by Code
<p>I am trying to develop a simple software to record a video with my android phone and store it on the sd-card.
The Problem is that this code does not run. Its in a loop and a do not understand why. I tried it by many tutorials but there is no help. 
In Android Manifest i put these permissions:</p>

<pre><code> &lt;uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /&gt;
 &lt;uses-permission android:name="android.permission.CAMERA"&gt;&lt;/uses-permission&gt;
 &lt;uses-permission android:name="android.permission.RECORD_VIDEO"/&gt;
 &lt;uses-permission android:name="android.permission.RECORD_AUDIO"/&gt;
</code></pre>

<p>And here is the Code button = start; button2 = stop</p>

<pre><code>Button button;
Button button2;

MediaRecorder recorder;

/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);

    button = (Button) findViewById(R.id.button1);
    button.setOnClickListener(listener);

    button2 = (Button) findViewById(R.id.button2);
    button2.setOnClickListener(list);

    recorder = new MediaRecorder();
    recorder.reset();
    recorder.release();
    Log.e("DAM", "msgliliashih");
}

public OnClickListener listener = new OnClickListener() {

    @Override
    public void onClick(View v) {
        Log.e("LAIS", "Button Click");
        File externalStorage = Environment.getExternalStorageDirectory();

        recorder.setVideoSource(MediaRecorder.VideoSource.DEFAULT);
                    //HERE IT STOPS!!!! DO NOT KNOW WHY!!!

        // recorder.setAudioSource(MediaRecorder.AudioSource.DEFAULT);
        recorder.setOutputFormat(MediaRecorder.OutputFormat.DEFAULT);
        recorder.setVideoEncoder(MediaRecorder.VideoEncoder.DEFAULT);
        recorder.setOutputFile(externalStorage.getAbsolutePath()
                + "video.mp4");
        recorder.setMaxDuration(60000); // Set max duration 60 sec.
        recorder.setMaxFileSize(5000000); // Set max file size 5M
        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(); // Recording is now started
        Log.e("Video", "Video Startet");

        // TODO Auto-generated method stub

    }
};

public OnClickListener list = new OnClickListener() {

    @Override
    public void onClick(View v) {
        // TODO Auto-generated method stub
        recorder.start();
        recorder.reset();
        recorder.release();
        Log.e("Video", "Video Stopped");
    }
};
</code></pre>

<p>If you have any Tips/Hints I am glad to here them.</p>

<p>THANK YOU SO FAR
GREETS SOMA</p>
