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
Highlighted
Regular Visitor
Posts: 1
Registered: ‎06-07-2011
My Device: 9700
My Carrier: T-Mobile

Simulator 7.1.0.267_9850 push / pop screen bug (probably)

[ Edited ]
Hello to everyone.
 
I encountered a strange simulator 9850 behaviour. When I pop and push the screen onto the stack several times, simulator freezes.
 
Here's the code that I use.
 
Main app class
 
public class MyApp extends UiApplication
{
    public static void main(String[] args)
    {
        MyApp theApp = new MyApp();       
        theApp.enterEventDispatcher();
    }

    public MyApp()
    {        
        pushScreen(new MyScreen());
    }    
}

 Screen 1

 

public final class MyScreen extends MainScreen
{
    ButtonField btn1;
    public MyScreen()
    {        
        btn1 = new ButtonField("To screen 2");
        FieldChangeListener btn1_l = new FieldChangeListener() 
        {   
         	public void fieldChanged(Field field, int context) 
        	{   
        		Utils.iteration ++;
       	 UiApplication.getUiApplication().popScreen(UiApplication.getUiApplication().getActiveScreen());
        		UiApplication.getUiApplication().pushScreen(new MyScreen2());
        	}   
        };   
        btn1.setChangeListener(btn1_l); 
        
        Manager layoutManager = new Manager(Manager.USE_ALL_WIDTH | Manager.USE_ALL_HEIGHT)
	{
        	public void paint(Graphics g) 
        	{
            	       g.drawText("Iteration " + Utils.iteration + "; screens " + UiApplication.getUiApplication().getScreenCount() + "; threads " + Thread.activeCount() + "; memory " + Memory.getRAMStats().getFree(), 10, 100);
            	super.paint(g);
        	}
		protected void sublayout(int w, int h) 
{ layoutChild(btn1, w, h); setPositionChild(btn1, 0, 0); setExtent(800, 480); } }; layoutManager.add(btn1); add(layoutManager); } }

 Screen 2 class is the same as Screen 1

 

It usually takes about 40 iterations to freeze the simulator.

Please advice, is it simulator bug, or something else?