Prompt Android mediarecorder error

Hi!

I have been developing android app which records sounds from the phones mic. Error happens when trying to excecute this method:
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
public void startRecording(View view) {
System.out.println("Start recording");

final Button aloita = (Button) findViewById(R.id.button3);
final Button lopeta = (Button) findViewById(R.id.button2);


recorder.setAudioSource(MediaRecorder.AudioSource. MIC);
recorder.setOutputFormat(MediaRecorder.OutputForma t.THREE_GPP);
recorder.setAudioEncoder(MediaRecorder.AudioEncode r.AMR_NB);
recorder.setOutputFile(tiedostonimi);

try {
recorder.prepare();
} catch (IOException e) {

Log.e(LOG_TAG, "prepare() kusi");
}

System.out.println(LOG_TAG);

recorder.start();

aloita.setEnabled(false);
lopeta.setEnabled(true);

}
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Error: Unfortunately myapp has stopped
LogCat: Could not excecute method of the activity and then some onClick errors

If I comment all the recorder.* from this method the app works fine. (I use also System.out.println as a debug tool)

I need help!

Update:
I changed the outputfiles variable and now I've got error: start called in an invalid state: 4.