I want to use MediaRecorder to record voice, my code is:
public void record(View v) {
Log.d(TAG, \"record\");
this.mediaRecorder.setAudioChannel
This is a big problem but has a very small solution
In most cases, the filename that we get from this.file.getAbsolutePath() contains file:/// as a prefix
////////////////////////////////////////////////* INCORRECT CODE */
this.mediaRecorder.setOutputFile(this.file.getAbsolutePath());
/*the above line sets a file url beginning with a "file:///"
//however, since this setOutputFile requires us to send a
//string referring to the uri, we will have to get rid of the
//"file:///" and simply write the uri */
////////////////////////////////////////////////* CORRECTED CODE BELOW */
this.mediaRecorder.setOutputFile(this.file.getAbsolutePath().substring(8));
/*the above line of code extracts the string uri eliminating
// file:/// */
Hope you find this answer helpful