08-13-2010 06:06 AM
Hi,
I'm trying to record some of the runtime logs on my local machine.
But I found I cannot use FileOutputStream, since I cannot import JRE6 once BlackBerry JRE 5.0 is imported. (It would cause error while compiling.)
Is there any easy way to write into files on local, in a class that is extended from UiApplication?
Solved! Go to Solution.
08-13-2010 06:10 AM
BTW, I cannot use System.out.println() to print some information to console.
Is there any way to do so? Thanks.
08-13-2010 06:44 AM
Not clear on what you are trying to do.
Remember that the code you write for a Blackberry runs on a BlackBerry, which is completely independent of any PC. SO you are not going to be able to do I/O to your PC's file system - the BlackBerry does not know about it. There are a few tricks that the Simulator pulls to make life easier for you when developing.
Regarding Blackberry specific class for logging, look at EventLogger.
08-13-2010 06:52 AM
Thanks. I'm going to try this way.
08-13-2010 07:13 AM
You can also use a local directory as your SDCard and you can write a file using
08-13-2010 07:39 AM
"You can also use a local directory as your SDCard"
One of the tricks that the Simulator pulls. Remember that logging to the SD Card assumes that the user has an SD Card and that there is space and that they don't have anything else in the same place. I must admit I have resisted doing this. But it does work!
08-13-2010 07:42 AM
I agree with you to a certain degree Peter. But I usually give the user the option to choose where to save the log file. Either in the persistent store, SDCard, or local memory. It's easier to email the log as attachment when it's in the file system.
08-13-2010 07:58 AM
Excellent implementation BB-Dude!
08-13-2010 09:04 AM
Thanks guys! It helps a lot.
09-09-2010 10:42 PM
Hi BB-Dude,
Would you please give an example on how to use thejavax.microedition.io.file.* to write a file on SD card?
Thanks!