score:1
Accepted answer
i'm still not sure what was the problem, but i think there was something wrong with the way i stopped recording (the whole try, catch thing). i just rewrote the whole code and put the mediarecorder in two different methods. startrecording() and stoprecording() method. and now it works perfectly!
startrecording()
public void startrecording (){
recorder = new mediarecorder();
recorder.reset();
recorder.setaudiosource(mediarecorder.audiosource.camcorder);
recorder.setoutputformat(mediarecorder.outputformat.three_gpp);
recorder.setaudioencoder(mediarecorder.audioencoder.amr_nb);
if (environment.getexternalstoragestate().equals(environment.media_mounted))
{
externalstoragepath = environment.getexternalstoragedirectory().getabsolutepath();
externaloutputpath = externalstoragepath + file.separator + "/android/data/com.whizzappseasyvoicenotepad/test.mp3";
recorder.setoutputfile(externaloutputpath);
}
else
{
storagepath = environment.getdatadirectory().getabsolutepath();
recorder.setoutputfile(storagepath + "/android/data/com.whizzappseasyvoicenotepad/test.mp3");
}
recorder.setonerrorlistener(errorlistener);
recorder.setoninfolistener(infolistener);
try {
recorder.prepare();
recorder.start();
} catch (illegalstateexception e) {
// todo auto-generated catch block
e.printstacktrace();
} catch (ioexception e) {
// todo auto-generated catch block
e.printstacktrace();
}
}
stoprecording()
public void stoprecording() {
if (null != recorder) {
recorder.stop();
recorder.reset();
recorder.release();
recorder = null;
}
}
Source: stackoverflow.com
Related Query
- File that I recorded with MediaRecorder can't be played
- Cant see changes in .java file when running Junit with Eclipse before mvn install
- Opening a file in Eclipse that is associated with another program
- Gradle does not copy xml file that store with java file to war file when it assemble
- Trying to rename recorded file with a method
- Eclipse project with file resources that I'd like to write out on application start
- Remove association for a file that begins with a '.' (no extension)
- I am having trouble with Java in Eclipse with finding a file that is clearly there
- Scanner cant find my file to read [Java with eclipse]
- How to open a java file with java editor that eclipse owns?
- Can't find the file directory after I stopped recording with MediaRecorder
- eclipse create jar file with txt file that can be referred to
- I have an external executable jar file that I wish to edit the java files in it with Eclipse
- Android xml error: "No resource found that matches the given name" with RelativeLayout (@id/LinearLayout_acc, @id/ProgressBar_statusScreen)
- Class file name must end with .class exception in Java Search
- ctrl-click goes to the declaration of the method I clicked. For interfaces with one implementation, how can I just directly go to that implementation?
- Eclipse source out of sync with file system
- Opening JSF Facelets page shows "This XML file does not appear to have any style information associated with it."
- Error : No resource found that matches the given name (at 'icon' with value '@drawable/icon')
- Best ways to deal with properties values in XML file in Spring, Maven and Eclipses
- Debugging jar file with source code attached in eclipse
- Unable to create a file with foreign language characters
- No JREs installed in the work space that are strictly compatible with this environment
- What is the best, free, subversion control repository that can be used with the Eclipse subversion plugin?
- How to undelete a file with Subversive?
- Where do I put the txt file that I want to read in Java?
- Automatically Creating Manifest File with Eclipse for JAR Files
- A project with that name already exists in the workspace eclipse
- Problem with relative file path
- Error: No resource found that matches the given name (at 'theme' with value '@style/AppTheme')
More Query from same tag
- Troubles with AndroidSlidingUpPanel with Eclipse - Error Inflating class
- eclipse debugging is not working as expected
- Java NoClassDef found error when executing via terminal
- How to build automatically different JARs from same code using Eclipse?
- Extracting to an Executeable JAR using eclipse
- What does using a "." without an object in Android (or java) mean?
- Find unused public members in Eclipse
- how to setup icepick on eclipse? What annotation processors to add to factory path?
- undefined reference to `pthread_create' on Yocto plugin on Eclipse IDE on Ubuntu
- NLS missing message: Obsolete_attribute_name___ERROR_ in:
- Group Id and package name in Eclipse java web application using maven
- How to compile gsoap with eclipse?
- How to disable pydev code analysis and keep pylint code analysis
- Eclipse and Pydev Python
- Eclipse e4 RCP SourceViewer syntax coloring
- Display and Expressions views disappearing on Debug perspective
- Visual Studio Pro 2008: Equivalent of Eclipse's member list?
- Selenium - eCLIPSE - WebDriver Alert Handling - Query
- Interface builder in Eclipse for Android: how to see my activity in fullscreen?
- Commit with specific date using JGit Eclipse
- android: how to open a file out of my app
- php debugging in eclipse
- How do I make an editor the default editor for all unknown files in Eclipse?
- Application is crashing with null pointer exception if i pass null value to method
- Navigation Drawer generated by Eclipse, and Fragment instantiation in a smarter way?
- Android/Java - Calling random function only works once
- Creating Web Service Client from WSDL that requires SSL certificate
- Configure Eclipse and PyDev for PyQt5 QtWebEngineWidgets?
- Why doesn't mod run, but instead gives error "TEST1 TEST2 disabled"?
- If statement in for loop only running once in JAVA