开发者

Android sound record problem

I'm trying to record sound on android, using code basically just copied from the developer docs, here it is:

    mFileName = Environment.getExternalStorageDirectory().getAbsolutePath();
    mFileName += "/audiorecordtest.3gp";
    mRecorder = new MediaRecorder();
    mRecorder.setAudioSource(MediaRecorder.AudioSource.MIC);
    mRecorder.setOutputFormat(MediaRecorder.OutputFormat.THREE_GPP);
    mRecorder.setOutputFile(mFileName);
    mRecorder.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB);

I get a runtime exception on开发者_如何学运维 the 4th line, I@m not sure why. Could you help?


Top tip: - Always check you've given your app the appropriate permissions! I forgot to let my app record sound.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜