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

Reply
New Contributor
Posts: 9
Registered: ‎04-10-2011
My Device: Blackberry Storm 9530
My Carrier: Verizon
Accepted Solution

App has Blank White Screen in Debugger

Hello, 

 

I am making an app with a simple pattern of checkboxes and buttons that set off players for audio files.  It had been working perfectly, no problems, and then seemingly out of the blue a blank white screen starting showing up when I tried to start the app in the debugger. 

 

I have cleaned the simulator file, gone through and deleted all the .debug files, and have reinstalled the JDE. It still will not work. I am working with JDE 4.7 simulating on the Storm. I will post some code shortly. Does anyone have any idea why it would suddenly start doing this? I have not made any significant changes to the code from when it was working properly. 

New Contributor
Posts: 9
Registered: ‎04-10-2011
My Device: Blackberry Storm 9530
My Carrier: Verizon

Re: App has Blank White Screen in Debugger

Here are the code samples:

 

import net.rim.device.api.ui.UiApplication;
import net.rim.device.api.ui.*;
import net.rim.device.api.ui.container.*;
import net.rim.device.api.ui.component.*;
import net.rim.device.api.ui.component.LabelField;
import javax.microedition.media.*;
import javax.microedition.media.control.*;
import java.io.*;
import java.io.InputStream;



/**
 * 
 */
public class TestSoundFileII extends UiApplication{
    public TestSoundFileII() {
        
        TestSoundFileIIMainScreen mainScreen = new TestSoundFileIIMainScreen();
        pushScreen(mainScreen);
        
            }
            
            public static void main(String[] args) {
                TestSoundFileII app = new TestSoundFileII();
                app.enterEventDispatcher();
            }
} 

 And then the MainScreen:

 

\\imports up here, omitted for brevity


public class TestSoundFileIIMainScreen extends MainScreen implements FieldChangeListener {
    
    ButtonField thunderSample;
    ButtonField birdsSample;
    ButtonField whalesSample;
    ButtonField forestSample;
    ButtonField oceanSample;
    ButtonField trafficSample;
    CustomButtonField testTime;
    
    String x;
 
 CheckboxField fiveCheckbox = new CheckboxField("Five Minutes", false);
 CheckboxField tenCheckbox = new CheckboxField("Ten Minutes", false);
 CheckboxField twentyCheckbox = new CheckboxField("Twenty Minutes", false);
 CheckboxField thirtyCheckbox = new CheckboxField("Thirty Minutes", false);
 CheckboxField fortyfiveCheckbox = new CheckboxField("Forty-five Minutes", false);
 CheckboxField hourCheckbox = new CheckboxField("One Hour", false);
 
 CheckboxField thunderCheckbox = new CheckboxField("Storm", false);
 CheckboxField birdsCheckbox = new CheckboxField("Birds     ", false);
 CheckboxField whalesCheckbox = new CheckboxField("Whales", false);
 CheckboxField forestCheckbox = new CheckboxField("Forest", false);
 CheckboxField oceanCheckbox = new CheckboxField("Ocean", false);
 CheckboxField trafficCheckbox = new CheckboxField("Traffic", false);
 
 
 
 LabelField thunderLabel = new LabelField("          ", Field.FIELD_RIGHT);
 
 LabelField whalesLabel = new LabelField("        ", Field.FIELD_RIGHT);
 LabelField forestLabel = new LabelField("          ", Field.FIELD_RIGHT);
 LabelField oceanLabel = new LabelField("          ", Field.FIELD_RIGHT);
 LabelField trafficLabel = new LabelField("          ", Field.FIELD_RIGHT);
 
 LabelField twoLabel = new LabelField("     ", Field.FIELD_RIGHT);
 LabelField threeLabel = new LabelField("     ", Field.FIELD_RIGHT);
 LabelField fourLabel = new LabelField("     ", Field.FIELD_RIGHT);
 LabelField fiveLabel = new LabelField("     ", Field.FIELD_RIGHT);
 LabelField sixLabel = new LabelField("     ", Field.FIELD_RIGHT);
 LabelField sevenLabel = new LabelField("     ", Field.FIELD_RIGHT);
    
    public void TestSoundFileIIMainScreen() {
        
        thunderSample = new ButtonField("Sample", ButtonField.CONSUME_CLICK);
        birdsSample = new ButtonField("Sample", ButtonField.CONSUME_CLICK);
        whalesSample = new ButtonField("Sample", ButtonField.CONSUME_CLICK);
        forestSample = new ButtonField("Sample", ButtonField.CONSUME_CLICK);
        oceanSample = new ButtonField("Sample", ButtonField.CONSUME_CLICK);
        trafficSample = new ButtonField("Sample", ButtonField.CONSUME_CLICK);
        testTime = new CustomButtonField("Go", Color.WHITE, Color.LIGHTGREY, Color.LIGHTBLUE, Color.WHITE, 0);
        
        Background headerBackground = BackgroundFactory.createSolidBackground(Color.BLACK);
        HorizontalFieldManager header = new HorizontalFieldManager(Field.FIELD_HCENTER);
        add(new CustomLabelField ("Choose your sound and playback time. Then press Go", Color.WHITE, 0x000000, 0));
        
        
        LabelField birdsLabel = new LabelField("            ", Field.FIELD_RIGHT);
        
        
        
        HorizontalFieldManager oneManager = new HorizontalFieldManager(Field.USE_ALL_WIDTH);
        Background blackBackground = BackgroundFactory.createSolidBackground(Color.GRAY);
        oneManager.setBackground(blackBackground);    
         oneManager.add(thunderCheckbox);
         oneManager.add(thunderLabel);
         oneManager.add(thunderSample);
         oneManager.add(twoLabel);
         oneManager.add(fiveCheckbox);
         thunderCheckbox.setChangeListener(this);
         thunderSample.setChangeListener(this);
         fiveCheckbox.setChangeListener(this);
         add(oneManager);
         
         add(new SeparatorField());

\\I continue to create the managers to add the rest of the buttons and checkboxes, omitted here for brevity.

}

public void fieldChanged(Field field, int context) {
            
           
            
            if(thunderCheckbox.getChecked() == true&&fiveCheckbox.getChecked() == true&&field == testTime) {
                
                try {
                    
                InputStream i = getClass().getResourceAsStream("/thunder.wav");    
                final Player testplayer = javax.microedition.media.Manager.createPlayer(i, "audio/x-wav");
                testplayer.realize();
                testplayer.prefetch();
                VolumeControl volume = (VolumeControl)testplayer.getControl("VolumeControl");
                volume.setLevel(100);
                testplayer.setLoopCount(200);
                testplayer.start();
                
                 new Timer().schedule(new TimerTask() {
                    public void run() {
                    try {testplayer.stop();
                    } catch (Exception e) {
                        Dialog.alert(e.toString()); 
                        }
                        }                      
                }, 300000);
               
                             
            }catch(final Exception me){
                   UiApplication.getUiApplication().invokeAndWait(new Runnable() {
                       public void run() {
                           Dialog.inform(me.toString());
                           }
                           }); 
            } 
            }

\\This is repeated for the rest of the sound file and time combinations.

}

 I also have a CustomButtonField and CustomLabelField, which I can also post here if anyone thinks it will help. Thanks. 

Super Contributor
Posts: 257
Registered: ‎05-05-2011
My Device: 9700
My Carrier: AT&T

Re: App has Blank White Screen in Debugger

[ Edited ]

Hi,

 my first thought - install Eclipse BB full plugin. JDE is a **bleep**, and keep in mind both are buggy. From my personal experience - sometimes I have to twice clean simulators and project, and if you frequently install app on device then you will surely face problems with re-installing, I recommend BlackBerry Master Control Program 1.0.0.0 Beta 3. 

Moral of this - be prepared to very hidden errors and unexplained behavior. I guess it's one of the reasons why there are less then 15K apps on App World Smiley Happy

BTH, you can use profiler, and BB debugger isn't bad, I mean it often points out these hidden errors.

 

--Thought about white screen - usually it happens when you have overwritten paint method of the screen and left the body of the method blank. Does your app run fine in "Run" mode, not in "Debug"? Did you test it on device? What OS do you use in your project?

Super Contributor
Posts: 257
Registered: ‎05-05-2011
My Device: 9700
My Carrier: AT&T

Re: App has Blank White Screen in Debugger

[ Edited ]
If you want, I could upload this *hard-to-download* Eclipse full plugin. Then you just install 4.6, 4.7 and 5.0 SDK from the Eclipse easily. So let me know and I'll upload it somewhere.
New Contributor
Posts: 9
Registered: ‎04-10-2011
My Device: Blackberry Storm 9530
My Carrier: Verizon

Re: App has Blank White Screen in Debugger

tolmachevroman, thanks for the tips. I was able to download eclipse full plugin. I'll need some time to get familiar with it, then I'll post back here if it works. 

New Contributor
Posts: 9
Registered: ‎04-10-2011
My Device: Blackberry Storm 9530
My Carrier: Verizon

Re: App has Blank White Screen in Debugger

Well, I installed the Java Full Plugin for eclipse and installed the JDE 4.7 and copied over the code and it is still the same blank white screen, both in Run and Debug. Could it be the 9530 Simulator? 

New Developer
Posts: 5
Registered: ‎02-22-2011
My Device: Not Specified
My Carrier: Orange ES

Re: App has Blank White Screen in Debugger

Hi, in the constructor of Mainscreen you should add super():

 

 

  public void TestSoundFileIIMainScreen() {
        
        thunderSample = new ButtonField("Sample", ButtonField.CONSUME_CLICK);
        birdsSample = new ButtonField("Sample", ButtonField.CONSUME_CLICK);
        whalesSample = new ButtonField("Sample", ButtonField.CONSUME_CLICK);
        forestSample = new ButtonField("Sample"
  public void TestSoundFileIIMainScreen() {
        super();
        thunderSample = new ButtonField("Sample", ButtonField.CONSUME_CLICK);
        birdsSample = new ButtonField("Sample", ButtonField.CONSUME_CLICK);
        whalesSample = new ButtonField("Sample", ButtonField.CONSUME_CLICK);
        forestSample = new ButtonField("Sample", ButtonField.CONSUME_CLICK); 
New Contributor
Posts: 9
Registered: ‎04-10-2011
My Device: Blackberry Storm 9530
My Carrier: Verizon

Re: App has Blank White Screen in Debugger

When I add super(); it give an error that states "Constructor call must be the first statement in a constructor." This disappears when I remove the "void" statement from the constructor. However, the screen is still blank. 

New Developer
Posts: 5
Registered: ‎02-22-2011
My Device: Not Specified
My Carrier: Orange ES

Re: App has Blank White Screen in Debugger

First, for pushing a screen you need to have a constructor in the class, so you must remove void.

 

After that you can try using super();

 

Anyway, youcan try changing this:

 

public class TestSoundFileII extends UiApplication{
    public TestSoundFileII() {
        
        TestSoundFileIIMainScreen mainScreen = new TestSoundFileIIMainScreen();
        pushScreen(mainScreen);
         

for this:


public class TestSoundFileII extends UiApplication{
    public TestSoundFileII() {
        
        TestSoundFileIIMainScreen mainScreen = new TestSoundFileIIMainScreen();
        UiApplication.getUiApplication().pushScreen(mainScreen);
         
Developer
Posts: 1,041
Registered: ‎07-16-2008
My Device: ಠ_ಠ

Re: App has Blank White Screen in Debugger

You don't need to call super if there are no arguments to pass. It will get called by default in Java.

 

If you have Fields added to your screen and you are seeing a blank white screen, that means you got an exception. Probably in the paint method. Exceptions in the paint method get consumed, so it won't show in the log, it just won't paint the screen.