UiApplication using PopupScreen

Hi all

This is my first post on this amazing forum. I read through many large threads with lots of answers to the questions I had in my short time developing applications for the BlackBerry smartphone. Unfortunately, I hit my first stumbling block, which I'm sure will be very easy, but hey, we all start somewhere.

The question that I'm doing the experience simply creates a PopupScreen in the mainevent thread and wait for user input before continuing. In my days of Swing I just use an observable model and notify the application of change, but I seem to have trouble with this concept here. I tried to use the pushModalScreen and the pushGlobalScreen of the UiApplication class methods, but both give me a runtime... error pushGlobalScreen called by thread of non-event.

It seems to me missing something probably just in front of me, but I would appreciate help on this. I just use this example using the 9000 Simulator that is packed with the JDE v4.6

public static void main(String[] args) {
        MyApp app = new MyApp();
        app.enterEventDispatcher();
    }

    MyApp() {
        final PromptTest prompt = new PromptTest();
        invokeLater(new Runnable() {
            public void run() {
                pushGlobalScreen(prompt,1,UiApplication.GLOBAL_MODAL);
            }
        });
        continueProcess();
    }

    public void continueProcess() {
    // do something with input from PopupScreen
    }
}

Thank you.

Well, I'm a little bit embarrassed. I have solved my problem. Using just pushScreen, like any other approach and all simply migrate code to deal with in my fieldChangeListener. I don't know what I thought earlier. I'm sorry to have lost someone's time on this one.

Tags: BlackBerry Developers

Similar Questions

  • PopupScreen of application on JDE 4.5

    I would like to develop for JDE 4.5.

    When a user clicks a button in my application, the application makes an HTTP connection and it may take a while.  I would like to show you a GIF file I already created, however, I won't completely push a new screen to the display, but just a small popup image stack.  I know it can be done with the class PopupScreen for JDE 4.6 or higher, but I wonder how it can be done on JDE 4.5?

    Why don't you use PopupScreen on 4.5? This class is available on all JDE versions I know.

  • ToolTip for the button

    Nice day

    I'm new to the blackberry development. I created a bitmapbuttonfield using the examples of the advanced user interface. There is a button with an image. I want to display a ToolTip for the button when the button receives the focus. Can someone please help

    Thanks in advance

    Hello

    Use this code:

    package mypackage;
    
    import net.rim.device.api.ui.Field;
    import net.rim.device.api.ui.FieldChangeListener;
    import net.rim.device.api.ui.component.ButtonField;
    import net.rim.device.api.ui.component.Dialog;
    
    public final class MyScreen extends TooltipScreen
    {
    
        ButtonField btn1,btn2,btn3;
        public MyScreen() {
    
            btn1=new ButtonField();
            btn1.setChangeListener(new FieldChangeListener() {
                public void fieldChanged(Field field, int context) {
                    Dialog.alert("Button 1 Click");
                }
            });
            btn2=new ButtonField();
            btn2.setChangeListener(new FieldChangeListener() {
                public void fieldChanged(Field field, int context) {
                    Dialog.alert("Button 2 Click");
                }
            });
    
            btn3=new ButtonField();
            btn3.setChangeListener(new FieldChangeListener() {
                public void fieldChanged(Field field, int context) {
                    Dialog.alert("Button 3 Click");
                }
            });
            add(btn1, "Button 1");
            add(btn2, "Button 2");
            add(btn3, "Button 3");
    
        }
    
    }
    
    package mypackage;
    
    import java.util.Timer;
    import java.util.TimerTask;
    import java.util.Vector;
    
    import net.rim.device.api.ui.Field;
    import net.rim.device.api.ui.Graphics;
    import net.rim.device.api.ui.XYRect;
    import net.rim.device.api.ui.container.MainScreen;
    
    public class TooltipScreen extends MainScreen {
    
        TooltipScreen screen = this;
        boolean doRedraw = false;//prevent infinte redrawing
        Vector tooltips = new Vector();//vector to hold tooltip strings
        private Timer tooltipTimer = new Timer();
        private TimerTask tooltipTask;
        boolean alive = false;//is the tooltip alive? used to pop it after our timeout
        int count = 0;//used to calculate time tooltip is displayed
        //tooltip popup colours:
        int backgroundColour = 0xeeeeee;
        int borderColour = 0xaaaaaa;
        int fontColour = 0x666666;
        //the tooltip:
        String tooltip;
        int tooltipWidth;
        int yCoord;
        int xCoord;
        //region parameters:
        XYRect contentArea;
        int contentBottom;
        int contentRight;
    
        public TooltipScreen() {
            super();
    
            //when timeout reaches 100ms*20 ie. 2seconds set alive to false and redraw screen:
            tooltipTask = new TimerTask() {
    
                public void run() {
                    if (alive) {
                        count++;
                        if (count == 20) {
                            alive = false;
                            invalidate();
                        }
                    }
                }
            };
    
            tooltipTimer.scheduleAtFixedRate(tooltipTask, 100, 100);
    
        }
    
        //override add method adds an empty string to tooltip vector:
        public void add(Field field) {
            tooltips.addElement("");
            super.add(field);
        }
    
        //custom add method for fields with tooltip: add(myField, "myTooltip");
        public void add(Field field, String tooltip) {
            super.add(field);
            tooltips.addElement(tooltip);
        }
    
        public void setColours(int backgroundColour, int borderColour, int fontColour) {
            this.backgroundColour = backgroundColour;
            this.borderColour = borderColour;
            this.fontColour = fontColour;
        }
    
        //reset everything when user changes focus,
        //possibly needs logic to check field has actually changed (for listfields, objectchoicefields etc etc)
        protected boolean navigationMovement(int dx, int dy, int status, int time) {
            count = 0;
            alive = true;
            doRedraw = true;
            return super.navigationMovement(dx, dy, status, time);
        }
    
        protected void paint(Graphics graphics) {
            super.paint(graphics);
            if (alive) {
                Field focusField = getFieldWithFocus();
                tooltip = (String) tooltips.elementAt(screen.getFieldWithFocusIndex());
    
                //don't do anything outside the norm unless this field has a tooltip:
                if (!tooltip.equals("")) {
                    //get the field content region, this may fall inside the field actual region/coordinates:
                    contentArea = focusField.getContentRect();
                    contentBottom = contentArea.y + contentArea.height;
                    contentRight = contentArea.x + contentArea.width;
    
                    //+4 to accomodate 2 pixel padding on either side:
                    tooltipWidth = graphics.getFont().getAdvance(tooltip) + 4;
    
                    yCoord = contentBottom - focusField.getManager().getVerticalScroll();
                    //check the tooltip is being drawn fully inside the screen height:
                    if (yCoord > (getHeight() - 30)) {
                        yCoord = getHeight() - 30;
                    }
    
                    //check the tooltip doesn't get drawn off the right side of the screen:
                    if (contentRight + tooltipWidth < getWidth()) {
                        xCoord = contentRight;
                    } else {
                        xCoord = getWidth() - tooltipWidth;
                    }
    
                    //draw the tooltip
                    graphics.setColor(backgroundColour);
                    graphics.fillRect(xCoord, yCoord, tooltipWidth, 30);
                    graphics.setColor(borderColour);
                    graphics.drawRect(xCoord, yCoord, tooltipWidth, 30);
                    graphics.setColor(fontColour);
                    graphics.drawText(tooltip, xCoord + 2, yCoord);
                }
            }
            //doRedraw logic prevents infinite loop
            if (doRedraw) {
                //System.out.println("redrawing screen: " + System.currentTimeMillis());
                screen.invalidate();
                doRedraw = false;
            }
        }
    }
    
    package mypackage;
    
    import net.rim.device.api.ui.Font;
    import net.rim.device.api.ui.Graphics;
    import net.rim.device.api.ui.Manager;
    import net.rim.device.api.ui.UiApplication;
    import net.rim.device.api.ui.component.LabelField;
    import net.rim.device.api.ui.container.PopupScreen;
    import net.rim.device.api.ui.container.VerticalFieldManager;
    
    class MyTooltip extends PopupScreen{
        int _x;
        int _y;
        TooltipThread _tooltipThread;
    
        private MyTooltip(Manager manager) {
            super(manager);
         }
        public void sublayout(int width, int height)    {
            super.sublayout(width,height);
            setPosition(_x,_y);
            System.out.println("Tooltip x: " + Integer.toString(_x) + ", y: " + Integer.toString(_y));
        }
        protected void applyTheme() {
            // Overriden to suppress Border etc.
        }
        public void removeToolTip() {
            if ( _tooltipThread != null ) {
                _tooltipThread.dismiss();
            }
        }
        private void display(UiApplication uiApp, int x, int y, int displayTime) {
            _x = x;
            _y = y;
            _tooltipThread = new TooltipThread(uiApp, this, displayTime);
            _tooltipThread.start();
        }
    
        public static MyTooltip addToolTip(UiApplication uiApp, String toolTipString, int x, int y, int displayTime) {
            VerticalFieldManager manager = new VerticalFieldManager(Manager.FIELD_VCENTER|Manager.NON_FOCUSABLE) {
                protected void paint(Graphics graphics) {
                    graphics.setColor(0x00FFFFFF); // White
                    graphics.fillRect(0,0,getWidth(),getHeight());
                    graphics.setColor(0x00000000); // Black
                    graphics.drawRect(0,0,getWidth(),getHeight());
                    super.paint(graphics);
                }
            };
            MyTooltip toolTip = new MyTooltip(manager);
            LabelField label = new LabelField(' ' + toolTipString + ' ', LabelField.NON_FOCUSABLE);
            label.setFont(Font.getDefault().derive(Font.PLAIN, 16));
            toolTip.add(label);
            toolTip.display(uiApp, x, y, displayTime);
            return toolTip;
        }
    
        class TooltipThread extends Thread {
    
            Object _notifyObject = new Object(); // Used to allow user to dismiss this Tooltip
            PopupScreen _tooltip; // Screen we are going to display
            UiApplication _ourApplication; // access to pushGlobalScreen and dismissStatus from our Application
            int _displayTime; // in seconds
    
            public TooltipThread(UiApplication ourApplication, PopupScreen tooltip, int displayTime) {
                _tooltip = tooltip;
                _ourApplication = ourApplication;
                _displayTime = displayTime;
            }
    
            public void run() {
                _ourApplication.pushGlobalScreen(_tooltip, 999, false);
                synchronized(_notifyObject) {
                    try {
                        _notifyObject.wait(_displayTime * 1000);
                    } catch (Exception e) {
                    }
                };
                _ourApplication.dismissStatus(_tooltip);
            }
    
            public void dismiss() {
                // notify the waiting object to stop the Thread waiting
                synchronized(_notifyObject) {
                    _notifyObject.notify();
                }
            }
    
        }
    
    }
    
  • ToolTip transparent as to the size of the button by default.

    How can I implement a transparent bubble as the default?

    I mean the white text that appears on the development of the icons in the menu.

    Thanks in advance.

    Hello

    in this link:

    http://supportforums.BlackBerry.com/T5/Java-development/problem-with-ToolTip/m-p/102847/highlight/tr...

    user peter_strange put a code for a ToolTip:

    I'm the only copy & paste

    package ..;
    
    /*
    
    Display a 'Tooltip" (String) at a specified location for s specified time
    This Tooltip can also be removed.
    Note that in my testing, the display time is not consistent.
    
    Following example shows it being added and removed using focus events.
    
    ButtonField bf = new ButtonField("Test") {
        MyTooltip _tooltip;
        protected void onFocus(int direction) {
            if ( _tooltip != null ) {
                _tooltip.removeToolTip();
                _tooltip = null;
            }
            // Display tooltip at 50,50 for 5 seconds
            _tooltip = MyTooltip.addToolTip(UiApplication.getUiApplication(), "Press to test", 50, 50, 5);;
        }
        protected void onUnfocus() {
            if ( _tooltip != null ) {
                // We have displayed a Tooltip - remove it
                _tooltip.removeToolTip();
                _tooltip = null;
            }
        }
     };
    
    */
    
    import net.rim.device.api.ui.UiApplication;
    import net.rim.device.api.ui.Manager;
    import net.rim.device.api.ui.Graphics;
    import net.rim.device.api.ui.Font;
    import net.rim.device.api.ui.Screen;
    import net.rim.device.api.ui.component.LabelField;
    import net.rim.device.api.ui.container.VerticalFieldManager;
    import net.rim.device.api.ui.container.PopupScreen;
    
    class MyTooltip extends PopupScreen{
        int _x;
        int _y;
        TooltipThread _tooltipThread;
    
        private MyTooltip(Manager manager) {
            super(manager);
         }
        public void sublayout(int width, int height)    {
            super.sublayout(width,height);
            setPosition(_x,_y);
            System.out.println("Tooltip x: " + Integer.toString(_x) + ", y: " + Integer.toString(_y));
        }
        protected void applyTheme() {
            // Overriden to suppress Border etc.
        }
        public void removeToolTip() {
            if ( _tooltipThread != null ) {
                _tooltipThread.dismiss();
            }
        }
        private void display(UiApplication uiApp, int x, int y, int displayTime) {
            _x = x;
            _y = y;
            _tooltipThread = new TooltipThread(uiApp, this, displayTime);
            _tooltipThread.start();
        }
    
        public static MyTooltip addToolTip(UiApplication uiApp, String toolTipString, int x, int y, int displayTime) {
            VerticalFieldManager manager = new VerticalFieldManager(Manager.FIELD_VCENTER|Manager.NON_FOCUSABLE) {
                protected void paint(Graphics graphics) {
                    graphics.setColor(0x00FFFFFF); // White
                    graphics.fillRect(0,0,getWidth(),getHeight());
                    graphics.setColor(0x00000000); // Black
                    graphics.drawRect(0,0,getWidth(),getHeight());
                    super.paint(graphics);
                }
            };
            MyTooltip toolTip = new MyTooltip(manager);
            LabelField label = new LabelField(' ' + toolTipString + ' ', LabelField.NON_FOCUSABLE);
            label.setFont(Font.getDefault().derive(Font.PLAIN, 16));
            toolTip.add(label);
            toolTip.display(uiApp, x, y, displayTime);
            return toolTip;
        }
    
        class TooltipThread extends Thread {
    
            Object _notifyObject = new Object(); // Used to allow user to dismiss this Tooltip
            PopupScreen _tooltip; // Screen we are going to display
            UiApplication _ourApplication; // access to pushGlobalScreen and dismissStatus from our Application
            int _displayTime; // in seconds
    
            public TooltipThread(UiApplication ourApplication, PopupScreen tooltip, int displayTime) {
                _tooltip = tooltip;
                _ourApplication = ourApplication;
                _displayTime = displayTime;
            }
    
            public void run() {
                _ourApplication.pushGlobalScreen(_tooltip, 999, false);
                synchronized(_notifyObject) {
                    try {
                        _notifyObject.wait(_displayTime * 1000);
                    } catch (Exception e) {
                    }
                };
                _ourApplication.dismissStatus(_tooltip);
            }
    
            public void dismiss() {
                // notify the waiting object to stop the Thread waiting
                synchronized(_notifyObject) {
                    _notifyObject.notify();
                }
            }
    
        }
    
    }
    

    PD: Sorry for my English.

  • pushGlobalScreen (screen, priority, boolean inputRequired) and the deactivation of the application

    I try to use a snippet of a peter_strange post to create tooltips in my application. In the code snippet, the deprecated method pushGlobalScreen (screen, priority, boolean inputRequired) was used to display the pop up. The question I have is that whenever the application is disabled, the ToolTip stays on the screen covering the screen HomeScreen/Call. The behavior that I'm trying to achieve is the ToolTip to be hidden, with the rest of the application without the persistent effect. I tried to mingle with the priority.

    The code snippet below.

     class TooltipThread extends Thread {
    
            Object _notifyObject = new Object(); // Used to allow user to dismiss this Tooltip
            PopupScreen _tooltip; // Screen we are going to display
            UiApplication _ourApplication; // access to pushGlobalScreen and dismissStatus from our Application
            int _displayTime; // in seconds
    
            public TooltipThread(UiApplication ourApplication, PopupScreen tooltip, int displayTime) {
                _tooltip = tooltip;
                _ourApplication = ourApplication;
                _displayTime = displayTime;
            }
    
            public void run() {
                _ourApplication.pushGlobalScreen(_tooltip, 999, false);
                synchronized(_notifyObject) {
                    try {
                        _notifyObject.wait(_displayTime * 1000);
                    } catch (Exception e) {
                    }
                };
                _ourApplication.dismissStatus(_tooltip);
            }
    
            public void dismiss() {
                // notify the waiting object to stop the Thread waiting
                synchronized(_notifyObject) {
                    _notifyObject.notify();
                }
            }
    
        }
    

    Global screens appear above the other forms in the application (non-global).  So the behavior you see is expected.  To solve it, you need detect when your application has been disabled and moved to the background and pop your bubble screen.

  • BlackBerry API equivalent to that Toast of Android?

    Hello

    This question might be redundant to some other posts. But I want to make the requirement clear here. For example, create a new thread. I hope that all of us know the behavior of the Toast message in android. I need a similar in my BlackBerry App. Not as many features. Do not take any parameters. Just a hard short time interval, the message should be displayed on the screen. Even if the user interface crashes for this particular period, it is fine. But the message should not expect its closure as a Blackberry Dialog.alert () of the interaction of the user.

    So, can someone help me out here? is there an API available already? Or do I have to implement on my own? If Yes, can someone guide me the direction?

    Thank you

    Knockaert

    http://www.BlackBerry.com/developers/docs/7.1.0api/NET/rim/device/API/UI/component/status.html#show (...)
    a message for 2 seconds.

    You can create something more flexible by using popupscreen and a timertask.

  • Problem with the ToolTip?

    Hi, I created bitmapfields of ToolTips and these bimapfields are arranged in HorizontalFieldManager (similar to FaceBook).  IAM using PopupScreen to display ToolTips.  But the problem is after I push the popupscreen then it will show tooltip after that I have the popupscreen pop so the ToolTip closes. And the problem is after pushing the popupscreen, I pop the screen 2 seconds while 2 seconds of time iam impossible to pass to bitmapfilelds in horizontalfieldmanager.  So please help me to scroll the bitmapfields even the popupscreen is also involved.

    IAM using the code below.

    // This is class for my own tooltip which extends popupscreen
    class ZBBToolTip extends PopupScreen
    {
        int _x;
        int _y;
        public ZBBToolTip(Manager manager, int x, int y)
        {
            super(manager);
            _x = x;
            _y = y;
         }
        public void sublayout(int width, int height)
        {
            super.sublayout(width,height);
            setPosition(_x,_y);
         }
    
        protected void applyTheme() {
            System.out.println("Inside applyTheme");
        }
    
    }
    
    //This method will come in main application
    
    public void addToolTip(String toolTipValue, int toolTipHPosition)
        {
            HorizontalFieldManager manager = new HorizontalFieldManager(Manager.FIELD_VCENTER|Manager.NON_FOCUSABLE)
            {
                public void paint(Graphics graphics)
                {
                    graphics.setColor(Color.WHEAT);
                    graphics.fillRect(0,0,getWidth(),getHeight());
                    graphics.setColor(Color.BLACK);
                    graphics.drawRect(0,0,getWidth(),getHeight());
                    super.paint(graphics);
                }
            };
            toolTip = new ZBBToolTip(manager,toolTipHPosition,50);
            LabelField label = new LabelField(" "+toolTipValue+" ");
            Font zbbFont = Font.getDefault().derive(Font.PLAIN, 16);
            label.setFont(zbbFont);
            manager.add(label);
    
            invokeLater(new Runnable()
            {
                public void run()
                {
                    pushScreen(toolTip);
                }
            });
        }
        public void removeToolTip()
        {
            synchronized(this.getAppEventLock())
            {
                invokeLater(new Runnable()
                {
                    public void run()
                    {
                        try{
                            Thread.sleep(2000);
                            } catch (Exception e){}
                        popScreen(toolTip);
                    }
                });
            }
        }
    

    My apologies, yes the way to cancel a pushGlobalScreen is the dismissStatus.  Which means in your code, replace

    popScreen (toolTip);

    with

    dismissStatus (toolTip);

    Let me know how you go with it.

    In addition, can I recommend that you change the priority in your ToolTip from 0 to something greater, otherwise your ToolTip can block a true global screens WARNING.  I would use a very large number, such as 9999.  You only need to be in front of your screen, you don't want to block any other Global screen.  Sorry, I have no rational for the number to choose, but I certainly wouldn't use a very small number.

  • Custom menu

    How to change the color of the font in MenuItem in the menu? Also on the development of menuitem its font color should also be changed.

    the native menu can not be customized like that, you need to create your own menu, for example using popupscreen.

  • i18n for the dialog field

    Hi all,

    I have little doubt I18n.

    I have to show YES/NO type dialog to save the changes.

    My question is to know how to locate the button YES and in the field of dialogue?

    Thanks in advance.

    Sorry for my English.

    the dialog box is automatically localized. If you want to use a specific string, you must define your own dialog box. You can do this by using another manufacturer (with choice of object []) or, if you want all customized by using popupscreen.

  • "Switch Application" doesn't ever show in the menu - not more of roll MainScreen::makeMenu

    Hello

    I have a class derived from the screen. In this class, I have not replaced the makeMenu method. Yet, only 'close' present in the menu and "Swtich application" ever arises.

    This happens in the JDE 4.2 and 4.5 but does not reach the JDE 4.7.

    However I have seen applications that run on 4.2 which have an "application swtich" MenuItem.

    In the constructor of my class, I even tried calling the screen constructor with DEFAULT_MENU style, but no effect.

    -MO >

    Visible apps are available at ApplicationManager.

    And, of course, you can build your own Ribbon using PopupScreen popup.

  • How to change the position of the BB Menu?

    Hi all
    I would like to know how to change the position of the BB Menu. We made a personalized menu of BB and it appears in the upper right of the screen. I would like to know if it is possible to display the menu in the lower left side. We have checked RIM API, but did not find anything for this. Is there a way to do this? We could use other libraries or specific solution as it is very important for our project.

    Thank you

    Pedro

    It is not possible with the menus built-in mechanism.

    You can provide your own menu, using popupscreen and objectlistfield, for example. You can place this popup where you want.

  • Terms of Service dialog

    Dear Sir

    I wonder how to implement such terms of service screen has App World.

    I tried to make a class that extends the dialogue and build but how do I open it to start?

    I want to show if possible before the first screen is pushed.

    I have no problem to decide whether or not this is the first start of the application, this is already done.

    But I already have display problems of the dialog without a pushed screen application.

    And how close the application correctly if the user refuses?

    Best regards

    Bullety

    If you absolutely must push the TOS dialog box before the first screen of the application, you need to use pushModal() with the property 'GLOBAL '.

    I'd say ditch the dialog class and make your own TOS dialog using PopupScreen with a RichTextField for TOS text. You'll want to place two buttons 'Accept' and 'I refuse. "

    You provide a getResponse() (or other) method that returns the value of the key (such as 0 = Accetpt, 1 = decline). If the answer is the decline, you can call System.exit (0)

  • Shortcut key for the option in the dialog box?

    I created a line of dialog popup that emulates the default behavior of the standard throw/save/cancel prompt I see native BlackBerry apps (my code below).

    The only thing I can't seem to duplicate it, however, is that the keys shortcut for every menu item. I.e. on the native guests, S, D and C of each option characters are underlined, and press a letter to activate this option.

    Can anyone think of a way to do it? Thank you!

    Nicholas

    String [] choice = new String() {"Save", "Throw", "Cancel" ;}
    Dialogue diag = new dialog box ("Changes!", choice, null, 0, Bitmap.getPredefinedBitmap (Bitmap.QUESTION));
           
    int iResponse = diag.doModal ();
    If (iResponse == 0) {}
    record pressed
    If (doSave())
    System.Exit (0);
    Returns false;
    } ElseIf (iResponse == 1) {}
    Throw a hurry
    System.Exit (0);
    Returns false;
    } else {}
    you press on cancel or "back" button
    Returns true;
    }

    Do not use the static dialog box class, create your own using PopupScreen in your implementation of PopupScreen, keyChar() of substitution and detect the values of keys you are interested in.

  • Use of automatic start and RuntimeStore for UIApplication... Help!

    I have a UIApplication that runs in the background and uses another entry point. The problem I have is to initialize the high device. The application will be auto-start and being thrust into the RuntimeStore (it seems anyway), and it will run in the background once the device boots-to top. But when I launch the first time through the graphical interface, trying to retrieve the existing instance of the RuntimeStore, he just return null. Thus, it instantiates the app again and place it in the RuntimeStore again, and then this will work as expected. Why the RuntimeStore put or get does not work the first time when the application auto-start? Any ideas?

    Here's the code for my main application UI, which instantiaties just my screen class:

    public class MyApp extends net.rim.device.api.ui.UiApplication
    {
        private static final long APP_ID = 0xf46f5a7867d69ff0L;
    
        public static void main(String[] args)
        {
            RuntimeStore runtimeStore = RuntimeStore.getRuntimeStore();
            if (args != null && args.length > 0 && args[0].equals("gui"))
            {
                MyApp myApp = (MyApp)runtimeStore.get(APP_ID);
                if (myApp != null)
                {
                    myApp.requestForeground();
                }
                else
                {
                    runtimeStore.put(APP_ID, new MyApp(true));
                }
            }
            else
            {
                synchronized(runtimeStore)
                {
                    runtimeStore.put(APP_ID, new MyApp(false));
                }
            }
        }
    
        public MyApp(boolean isGui)
        {
            this.pushScreen(new MyAppScreen(isGui));
            this.enterEventDispatcher();
        }
    }
    

    I think your problem might be because

    enterEventDispatcher();

    never actually "return", then the set RuntimeStore does not end.

    Try the following code that does what you want.  I put some System.out.println statements for you can follow what is happening.  Place a breakpoint on the line after either of the enterEventDispatcher() to see if it's really there.

    public class MyApp extends net.rim.device.api.ui.UiApplication {
       private static final long APP_ID = 0xf46f5a7867d69ff0L;
    
       public static void main(String[] args) {
          RuntimeStore runtimeStore = RuntimeStore.getRuntimeStore();
          MyApp _myApp;
          if (args != null && args.length > 0 && args[0].equals("gui" ) ) {
              _myApp = (MyApp)runtimeStore.get(APP_ID);
              if (_myApp != null) {
                  System.out.println("Forground" );
                  _myApp.requestForeground();
              } else {
                  System.out.println("Create" );
                  _myApp = new MyApp(true);
                  runtimeStore.put(APP_ID, _myApp);              _myApp.enterEventDispatcher();
                  System.out.println("dispatched" );
              }
          } else {
              System.out.println("Auto Start" );
              _myApp = new MyApp(false);
              synchronized(runtimeStore) {
                  runtimeStore.put(APP_ID, _myApp);
              }
              System.out.println("Added" );
             _myApp.enterEventDispatcher();
              System.out.println("dispatched" );
          }
       }
    
       public MyApp(boolean isGui) {
           this.pushScreen(new MyAppScreen(isGui));
       }
    }
    
  • When should I use UiApplication popScreen()

    I was wondering where I should use popScreen (Screen screen)?

    My request is a bit like an iPhone app that has links in a ListField. When the user clicks on the back of a screen (form B) resume screen has, it is just as likely that screen B are not again.  If I break the screen, that means that if the user tries to go to the screen B, then the application will reload the contents of the network.

    If pop is indicated to be used then where can I detect the user pressing the back or previous menu item?

    From what I've seen, by pressing the back button makes popping on the screen the default stack. However, if the screen is a global object or static object he popping the stack does not destroy it, and if you push the same object screen, its State will remain as when he jumped. To get a new screen, you will need to make sure you create a new object.

Maybe you are looking for

  • Can I use App Store/iTunes credit to buy space iCloud?

    I think the upgrade of my storage drive to iCloud and want to use some App Store credit I have left more. Is it possible to buy a storage iCloud with this method of payment plan (and if so, how) or could it be charged on my credit card?

  • Upgrade processor to question 6100 speed

    Hi, I have a Sat Pro 6100 and currently my processor is powered by: -.Manufacturer: Inteltype: Mobile Intel® Pentium® 4 Processor - MClock speed: 1.8 GHzFront Side Bus: 400 MHzlevel 1:12 KB cache2nd level cache: 512 KBBasic voltage (AC): 1.3 Vcoproce

  • model not found on the lenovo Web site

    I recently purchased ideapad lenovoZ580, but I do not find this laptop model in the Web site. I have need for support and software update for this model. model no: 59-383215 3rd generation of Intel ci3 3110 m Windows 8 64-bit oem 4 GB of ram hard dri

  • Looking for information on connectors

    Not sure if this is the right forum, but I don't see anything else that could do it. I have a box adapter who wants to convert a 68 connector OR another connection.  It contains only a single buffer chip. Code PIN/signal names are as follows. 1/VCC (

  • Password BIOS HP 4730 s

    Can u please help me with a bios password on my HP 4730 s CNU2163490. Its in German. Thank you. {Information}