hackster84 Posted May 27, 2014 Share Posted May 27, 2014 Hi, I am a hardware programmer who is new to the Android programming world. I'm running into an error that doesn't quite make sense and I'm looking for a little insight as to how I might go about fixing it. I'm writing an app that does serial communication using the 3.5mm audio jack. I have one app that runs perfectly, so in order to create the new app, I simply imported the code from the previous app into the new app. After making very minor alterations to the main activity java file and the layout.xml file, I get an error that says that says "startRecording() called on an uninitialized AudioRecord." I've gone through the whole app and I am unable to find why the system thinks that the AudioRecord isn't initialized. I've even gone as far as to copy the initialization of the AudioRecord to the line that immediately precedes the call to startRecording() with no change in the error message. The initialization and call that causes the error is as follows: AudioRecord _audioRecord; _audioRecord = new AudioRecord(MediaRecorder.AudioSource.DEFAULT, _sampleFrequency, AudioFormat.CHANNEL_IN_MONO, AudioFormat.ENCODING_PCM_16BIT, recBufferSize); _audioRecord.startRecording(); What could possibly be causing this error, especially since literally the exact same code works in another application? The code that I removed from the original app is simply a button click listener that changes the frequency of some audio output, so it shouldn't have any effect on the initialization code since it doesn't even get called until the button gets pushed. Any thoughts on the matter would be greatly appreciated. Thanks in advance for your help, -Chris Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.