Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

OutOfMemory Exception while recording audio

 
Bhanu Peruvemba
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I am trying to record audio and store in Rms. When I stop recording(using quitCommand) I get an OutOfMemory Exception. The following is the code that I write in the commandAction for quitCommand. I get an error when I do a rc.commit.Where rc is RecordControl ,store is RecordStore ,p is player and output is ByteArrayOutputStream. I have attached the snippet of the code here . Could anyone please let me know where I am wrong.

Thanks in advance
bhanu

public void commandAction (Command choice, Displayable displayable)
{
System.out.println("Insider Command Action");
if (choice == quitCommand)
{
try
{
p.stop();
rc.stopRecord();
rc.commit();
byte[]b = output.toByteArray() ;
store.addRecord( b,0,b.length);
}catch (Exception ex){
ex.printStackTrace() ;
}

}
}
 
Nidheesh Puthalath
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The outofmemory exception will occur in the simulator b'coz of some compatibility issues. u load it into the handset and test. it may work.

Nidheesh
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic