求java大神帮我看看我这个安卓开发的程序哪里出错

package com.example.maapp;
public class record extends Activity {
private long startTime;
File file;
Button press;
MediaRecorder recorder= new MediaRecorder();

//判断是否长按
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_record);
press=(Button)findViewById(R.id.press);
//手指监听函数
press.setOnTouchListener(new OnTouchListener() {

@Override
public boolean onTouch(View view, MotionEvent event) {
switch (event.getAction()) {
case MotionEvent.ACTION_DOWN:
prepareRecord();
break;
// case MotionEvent.ACTION_MOVE:
// hint();
// break;
case MotionEvent.ACTION_POINTER_UP:
if(event.getY()<-50){
cancleRecord();
}else{
finishRecord();
}
break;
}
return true;
}

});
}

protected void cancleRecord() {
stopRecording();
//show canceled picture
file.delete();
}
private void prepareRecord() {
startTime=System.currentTimeMillis();
//show recording picture
startingRecording();
}
private void finishRecord() {
long totalTime=System.currentTimeMillis()- startTime;
//show totalTime number
stopRecording();
}
private void stopRecording() {
recorder.stop();
}
private void startingRecording() {
recorder.setAudioSource(MediaRecorder.AudioSource.MIC);
recorder.setOutputFormat(MediaRecorder.OutputFormat.THREE_GPP);
recorder.setAudioEncoder(MediaRecorder.AudioEncoder.DEFAULT);
long stringName=System.currentTimeMillis();
String path=Environment.getExternalStorageDirectory().toString()+"/lovely/"+stringName+".mp4";
file=new File(path);
if(!file.exists()){
try{
file.createNewFile();
}catch(IOException e){
e.printStackTrace();
}
}
recorder.setOutputFile(path);
try{
recorder.prepare();
recorder.start();
}catch(IOException e){
e.printStackTrace();
}
}
}
工具:eclipse ,安卓,java 备注:1.贴出来的程序省略了import的东西(字太多了) 2.已经注册了manifest,xml里应该也是没错的。 3.我现在是要从mainActivity页跳转到record页,record页里有个press按钮,可是一按按钮app就闪退。求大神 帮帮看下程序哪里写错!!!

错误提示呢?追问

追答

对这个不太懂,不过说了你recorder.setAudioSource设置失败,

http://blog.csdn.net/ameyume/article/details/7884118
看这个也许你可以找到错误,一般这种必须按照它的步骤来设置,否则会出错

温馨提示:答案为网友推荐,仅供参考