BlackBerry Forums Support Community

BlackBerry Forums Support Community (
-   Developer Forum (
-   -   Best Way to Implement a Debug Screen (

smheoc 04-14-2005 09:16 AM

Best Way to Implement a Debug Screen
I have developed a few apps that work together. I have also created an OptionsProvider, under which I want the option to display a "debug" screen. This debug screen should contain messages sent by any of the other applications in my suite.
My first attempt at this did work (using a RunTime object (string) which I appended to every time). The problem is that when I run it the first time everything is good, but if I exit the debug screen then I can never access it again because I get an Exception.

Is there a bettery way to create such a debug screen?

arconsulting 04-15-2005 06:52 AM

I create debug screens that require a certain series of keystrokes to display. Similar to the display of RIM's log screen (ALT-L-G-L-G).

In my KeyListener, I check for ALT plus the keys and display my screen.

smheoc 04-15-2005 10:22 AM

I have toyed with that idea, but it isn't really required for my application. In any event, the problem wasn't so much "how to access the screen", but rather, how to pass data from other applications.

Right now I am using a RuntimeStore object (a string) which I append to. The problem is that when I show the screen it does not get updated in realtime.

Other applications write to the debug screen by calling:

DebugScreen.DebugMessage("This is my message");
The OptionsProvider creates the screen when required, and the constructor creates a RichTextField.


class DebugScreen /*...*/{
  private static RichTextField _output;
  /* ... */
  public DebugScreen(){
      /* ... */
      String strCurrOutput = /* Get from runtime store */
      _output = new RichTextField("Started...\n" + strCurrOutput);

  /* ... */
  public void DebugMessage(String msg){
      /* add msg to runtimestore object */
      if(_output != null){
        _output.setText( textfromruntimestore );

When I first open the debug screen, I get all debug messages that were present in the runtime store (no problem there). The problem is that while the window is open, it never gets updated!

smheoc 04-15-2005 10:52 AM

I have a working solution now, however I welcome recommendations...

I have created two RuntimeStore objects, one String to contain all the messages, and one RichTextField to indicate if the window is visible.

1) In the constructor for the display, I create the RTF object and populate it with the String contents.

2) In the onClose() function I remove the RTF from the RuntimeStore.

3) In the the DebugMessage function, I add the message to the String, and if the RTF object exists, then the window is created, so I add the new string to it. Otherwise, the debug window is not open so I don't need to worry.

I realize that this is pretty shabby coding, but it works. Any suggestions for improvement?

jbartel 04-15-2005 12:57 PM

Is there a reason why you don't want to use the system log?

smheoc 04-15-2005 01:47 PM

I suppose there isn't really a "good" reason why I don't just use the system log. However I want to provide the users with a "one-stop-shopping" location to go for the troubleshooting messages. Rather than have to tell them all "Hit Alt-LGLG and tell me what you see", I can have them access my debug menu from my options menu.

This is more intuitive to the user and I have more control over what they are seeing.

All times are GMT -5. The time now is 02:13 PM.

Powered by vBulletin® Version 3.6.12
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.