Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development


Thank you for visiting the BlackBerry Support Community Forums.

BlackBerry will be closing the BlackBerry Support Community Forums on April 1st. BlackBerry remains committed to providing excellent customer support to our customers. We are delighted to direct you to the CrackBerry Forums, a well-established and thorough support channel, for continued BlackBerry support. Please visit http://forums.crackberry.com or http://crackberry.com/ask. You can also continue to visit BlackBerry Support or the BlackBerry Knowledge Base for official support options available for your BlackBerry Smartphone.

"When we launched CrackBerry.com 10 years ago, we set out to make it a fun and useful destination where BlackBerry Smartphone owners could share their excitement and learn to unleash the full potential of their BlackBerry. A decade later, the CrackBerry community is as active and passionate as ever and I know our knowledgeable members and volunteers will be excited to welcome and assist more BlackBerry owners with their questions."

- Kevin Michaluk, Founder, CrackBerry.com


Reply
Developer
Posts: 211
Registered: ‎04-29-2009
My Device: Not Specified
Accepted Solution

Read file stored on sdcard while debugging an application

Hi,

I am trying to record a wav file and save it on sdcard of device. Im using Pearl with 4.5 OS.

Whenever I debug the application on real device, I am not able to read the file or even write file to sdcard...

How I can read and write files on sdcard? 

Developer
Posts: 289
Registered: ‎10-17-2008
My Device: Torch 9800
My Carrier: Rogers

Re: Read file stored on sdcard while debugging an application

Hi tejaswini,

 

It would be helpful if you posted the code you are currently using to try to read/write.

 

FileConnection fconn = (FileConnection)Connector.open("file:///SDCard/BlackBerry/documents/data.dat");

if (fconn.exists())

{

  DataInputStream disRead = fconn.openDataInputStream();

  try

  {

    int iData = disRead.read();

  }

  catch (IOException ioe)

  {

  // exception handling 

  }

}

 

For further information, look up the FileConnection, DataInputStream, and DataOutputStream classes in the API library.

 

--------------------------------------------------------------------------------------------------------
If your issue is solved, set "Solution" mark at the relevant post.
Don't hesitate to Kudos people whose posts helped you.

 

feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
Highlighted
Developer
Developer
Posts: 283
Registered: ‎07-22-2008
My Device: Not Specified

Re: Read file stored on sdcard while debugging an application

It looks like you have the Mass Storage Mode on when you connect via USB.

So make sure that it is not the case:

 

go to the device options-->Media Card  and set " Auto Enable Mass Storage Mode When Connected" to "No", or to Prompt.

If you set it to prompt, it will ask you when you connect the device, and you should answer NO.

 

Make sure that you the device is not connected to USB when you set it.

 

Rab