android - RuntimeException in MediaRecorder.start() -


i have runtimeexception when call method "start()" on mediarecorder object. can not paste stack trace because have discovered bug on google analytics. code:

    mediaplayer p = new mediaplayer();     final mediarecorder recorder = new mediarecorder();     recorder.setaudiosource(mediarecorder.audiosource.mic);     final string path = getoutputaudiofilepath(activity);     if (path == null)         return;     recorder.setoutputformat(mediarecorder.outputformat.three_gpp);     recorder.setaudioencoder(mediarecorder.audioencoder.amr_nb);     recorder.setoutputfile(path);     recorder.setmaxduration(300000);     try {         recorder.prepare();     } catch (ioexception e) {         toast.maketext(activity,e.getmessage(),toast.length_long).show();     }     recorder.start(); 

i run code , it's right. works. used

final string path = getfilesdir().getabsolutepath()+"/myfile" 

instead.

so make sure getoutputaudiofilepath(activity) method returning valid path , path not require manifest permissions haven't added, cause might lead exception getting.


Comments

Popular posts from this blog

java - WrongTypeOfReturnValue exception thrown when unit testing using mockito -

php - Magento - Deleted Base url key -

android - How to disable Button if EditText is empty ? -