BlackBerry Forums Support Community               

Closed Thread
 
LinkBack Thread Tools
Old 10-09-2010, 12:21 PM   #1 (permalink)
Thumbs Must Hurt
 
Join Date: Jan 2010
Model: 8300
PIN: N/A
Carrier: T-Mobile
Posts: 62
Post Thanks: 1
Thanked 0 Times in 0 Posts
Default Cod file too big error

Please Login to Remove!

I have a program that includes a bunch of mp3 files which I have added using the resources tab

The idea is to play any of those files when the user selects any one of them

But the problem is that when I try generating the cod file , it shows error saying

PlaySnd.cod data section too large: 138216 bytes

I have been using 4.5 and also tried developing it on JDE 4.7 , but I still get the same error

Can any one please say how I can over come it ?

How can I split the cod file or use the library option ?
Offline  
Old 10-13-2010, 05:42 PM   #2 (permalink)
New Member
 
Join Date: Jul 2010
Model: 9700
PIN: N/A
Carrier: Verizon
Posts: 11
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default Probably can't

I am not positive but if a resource itself is too large to fit into a single COD file then there might not be any way of breaking it up. For resources that large it would probably be better to store them in a directory on the SD card and read them in from there.
Offline  
Old 10-14-2010, 08:47 AM   #3 (permalink)
Thumbs Must Hurt
 
Join Date: Jan 2010
Model: 8300
PIN: N/A
Carrier: T-Mobile
Posts: 62
Post Thanks: 1
Thanked 0 Times in 0 Posts
Default

Can you please say how I can add files to the SDCard ?

As much as I tried , I couldn't find a way to add any files to the SD Card on the simulator
Offline  
Old 10-19-2010, 10:12 AM   #4 (permalink)
Knows Where the Search Button Is
 
Join Date: Sep 2010
Model: bold
PIN: N/A
Carrier: tmobile
Posts: 16
Post Thanks: 1
Thanked 0 Times in 0 Posts
Default

Put the following block in a loop to go over all your MP3's

String fileName = "/path/to/mp3";
InputStream inputStream = getClass().getResourceAsStream(fileName);

String locator = "file:///SDCard"+fileName;
FileConnection saveFile = (FileConnection)Connector.open(locator);
saveFile.create();
OutputStream outputStream = saveFile.openOutputStream();
Offline  
Old 10-19-2010, 11:01 AM   #5 (permalink)
New Member
 
Join Date: Jul 2010
Model: 9700
PIN: N/A
Carrier: Verizon
Posts: 11
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default Actually...

Actually I don't think that will work. The problem he was having is that the MP3 is too large to fit into a COD file so he will not be able to get the resource as a stream as the jar is never actually created.

You will need some way of downloading the file (socket connections, HTTP posts, or just manual copy while in Mass Storage Mode) to actually get the file onto the SD card. After that you should be able to read it in as normal.
Offline  
Old 10-20-2010, 01:38 AM   #6 (permalink)
Thumbs Must Hurt
 
Join Date: Jan 2010
Model: 8300
PIN: N/A
Carrier: T-Mobile
Posts: 62
Post Thanks: 1
Thanked 0 Times in 0 Posts
Default

Quote:
Originally Posted by twola View Post
Put the following block in a loop to go over all your MP3's

String fileName = "/path/to/mp3";
InputStream inputStream = getClass().getResourceAsStream(fileName);

String locator = "file:///SDCard"+fileName;
FileConnection saveFile = (FileConnection)Connector.open(locator);
saveFile.create();
OutputStream outputStream = saveFile.openOutputStream();

Actually if I am unable to include the files into the Cod file , I was thinking of including them on the SDCard.Would this code copy those mp3 files onto the SDCard of my Simulator ?

What value should I use instead of
String fileName = "/path/to/mp3";

for my release version that would be run on an actual BlackBerry ?
Offline  
Old 10-20-2010, 01:43 PM   #7 (permalink)
New Member
 
Join Date: Jul 2010
Model: 9700
PIN: N/A
Carrier: Verizon
Posts: 11
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

That code reads in the file assuming it is already in your jar file (created from the COD file). That is what getClass().getResourceAsStream(fileName); does. It reads in a file included in the jar file, so no that would not work. The second portion of the code would copy them onto the SD card however that assumes you already have access to the file in order to read it in.

Again if you can't place it on the SD manually (through some settings on the simulator or copying and pasting the actual file to the simulators SD card directory) then you could replace the first portion of the code with a Web Service or Socket connection code to download the file from a web site you would need to host.

I would start by checking on the simulator options (as I am unfamiliar with them, I do all my testing on a phone) and see if it has SD card settings or directory and try placing the MP3 file there. If not put it on a web page and download it.
Offline  
Old 10-22-2010, 03:23 AM   #8 (permalink)
Thumbs Must Hurt
 
Join Date: Jan 2010
Model: 8300
PIN: N/A
Carrier: T-Mobile
Posts: 62
Post Thanks: 1
Thanked 0 Times in 0 Posts
Default

Any one know how to simulate files on an SDCard ?

I tried it but the Simulator goes on for hours without loading fully
Offline  
Closed Thread


Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On





Copyright 2004-2014 BlackBerryForums.com.
The names RIM and BlackBerry are registered Trademarks of BlackBerry Inc.