Screen to screen - illegalstateexception

Hi all

Try calling a help screen in a menu.  the code is-

protected void makeMenu (menu Menu, for example int) {}
Help of MenuItem = new MenuItem ("Help", 3, 3) {}
public void run()
{
System.out.println ("run...");
HR = new radhelp();
UiApplication.getUiApplication () .pushScreen (HR);
}
                        
};
menu. Add (Help);
menu.addSeparator ();
super.makeMenu (menu, for example);

but when it works I don't get not illegalstateexception cannot for the life of understand me how to stop what is happening and also how you get the println system.out for output in the output window of jde?

Thank you ad2apps

Hello

Have now it works instead of: -.

HR = new radhelp();
UiApplication.getUiApplication () .pushScreen (HR);

now: -.

UiApplication.getUiApplication () .pushScreen (new radhelp());

which works fine but why theres such a difference, I don't know!

Tags: BlackBerry Developers

Similar Questions

  • IllegalStateException during the loading of a screen

    Me once again. Don't worry, I've almost finished my app and I'm leaving for a nice weekend well-deserved tomorrow morning early

    anyway. On my first screen I call this code:

       public void fieldChanged(Field field, int context) {
            // TODO Auto-generated method stub
             if(field == ContactButton)
                {
    
                 UiApplication.getUiApplication().pushScreen(new Contact());
                }
             else if (field == DownloadButton)
             {
                    UiApplication.getUiApplication().pushScreen(new DownloadScreen());
    
             }
    
        }
    

    On my Contact button, when pressed, I get IllegalStateException. The download button is displayed and ListField events work fine

    What can be wrong?

    Hannes

    you add title twice comment both this setTitle (title); in your code

    We you add in optimizing resources like this (title) vfm.add;
    and second setTitle (title);

  • Avoiding IllegalStateException with inactive screens

    I tried to avoid the IllegalStateExceptions... like a n00b I get them pretty often. I realized doing something on the screen the user jumped (bad, bad!) often gives an illegal state. I tried to write a method to detect if the screen is higher up in the stack, so I check first before doing anything on the screen, so if I do anything in a thread and have to come back later, I check if the screen is active, first.

    {} public boolean isActive()
    return UiApplication.getUiApplication () .getActiveScreen () is this;
    }

    I realized a few questions/issues with this approach.

    • If the user has the menu open... This code considers that the screen be IN-active, so my code won't do anything while the menu is open
    • I'd get an illegal state if I try to touch the screen below the menu when the user has a menu open? If Yes, this means I would have if sit and wait until the screen activates before I run the code after that I'll be back on the wire?
    • Would I be better to copy the invokeLater, runnables tail model, and then run then when screen is active? As in, the implementation of ScreenUiEngineAttachedListener and then try something like this below...

    protected void invokeWhenActive (Runnable r) {}

    store the executable

    }

    public void onScreenUiEngineAttached (attached screen, boolean) {}

    {if (attached)}

    check if we have pending runnables...

    UiApplication.getUiApplication () .invokeLater (runnable);

    }

    }

    What best practices can I keep in the spirit of updating the screens? To give a concrete example. Users select a category of points of interest (for example, police station, hospital) of a screen then I press the display of the result list that begins with the display of a loading animation. Then it will update when I get the info.

    IllegalStateException may actually occur for various reasons.  But that being said, I'm not aware of any that are the result of a screen is not not the active screen.  So I suspect your presumption that it is the cause is not correct, I think that there is something else that goes along with the screen being burst that creates your problem.

    I usually print the exception (. toString()) to know exactly why I got it.  You will find examples of this kind of thing

    (a) you can get this by setting the focus on a field that is not actually on the screen - I think that the message will say something about "not apparent" or "not on the screen" (note that you can set the Focus on a field for a screen that is NOT on the top of the stack)

    (b) adding a field to a Manager when the field is already added to a Manager, I think the message will say "already apparent.

    So unless you print the detailed message, you will not be able to solve your problem.

    Regard to deliver you from editing screen, don't forget not that when you update a screen, you must have the lock on the event - that's all just a lock that makes sure that only one thing is updating the user interface at the same time.  Now all the event handlers (menu key, etc.) running on the event Thread, which means that they all have the lock.  You can take advantage of that too.  You can plan a Runnable t run on the thread of events, when he has the lock on the event.  To do this, use this "incantation":

    (UiApplication.getUiApplication), invokeLater (new Runnable() {}

    public void run() {}

    your UI code update

    }

    });

    Thus, you should use this kind of process when you get the information you want.  Then push the ' loading screen, start your thread to download, have the wire download use this incantation to display the loading screen, and update the user interface.

    Hope that answers the following questions:

    See more here:

    http://supportforums.BlackBerry.com/T5/Java-development/what-is-the-event-thread/Ta-p/446865

    http://supportforums.BlackBerry.com/T5/Java-development/blocking-operation-not-permitted-on-event-di...

  • IllegalStateException when adding label to the screen from timertask

    Hello

    I have a thread that gets the text for a labelfield. I just want to add the labelfield on-screen when the thread is finished.

    I have a timertask that checks when the thread is finished and when the thread is finished, he tries to add the label to the form.

    This is the code, but when I try to add the label I get illegalstateexception-

    GTC GetContent = new GetContent();
    t = new Thread (gtc);
    t.Start ();
                
    Timer = new Timer();
    timer.scheduleAtFixedRate (new TimerTask() {}
    public void run() {}
    {if (! t.IsAlive ())}
    Timer.Cancel ();
    Test string = t.getTextLabel ();
    addLabel (new LabelField (test));
    }
    }
    Invalidate();
    }
    (}, 1000, 1000);

    }
            
    Private Sub addLabel (LabelField l) {}
    Add (l);
    }

    If she runs in an external thread to wrap it in an invokelater (or the synchronization on the eventlock).

    You can check the exceptions by surrounding the code with a try/catch.

  • IllegalStateException when closing a screen in its constructor (single-threaded application)

    I use a screen that displays a list of items. The builder checks if there is nothing to display and if not, displays a dialog box with a message and call close(). The close() call produces IllegalStateException (on 5 BB). Why and how can I close or the screen?

    BTW, I read on do not call close() in a different thread, but in this case, I do not (at least in my code) any extra thread.

    public class MyScreen extends MainScreen implements ListFieldCallback
    {
      MyScreen()
      {
        super(Manager.NO_VERTICAL_SCROLL);
    
        int count = getItemsCount(); // A method that returns the number of items to display
    
        if (count == 0)
        {
          Dialog.inform("No item");
          close(); // throws IllegalStateException
          return;
        }
    
        // More irrelevant stuff here
    
      }
    }
    

    Thank you!

    My point was the call to close as the manufacturer, there is no possible way that the screen can be on the displaystack at the time wherever you call close...

    in another part of your code, you probably:

    uiApplication.pushScreen (new MyScreen());

    Push code will not happen before the end...

  • Error IllegalStateException when the construction of a screen

    1. the version of BlackBerry device software and BlackBerry model test you it with (or simulate). You can find this information under Options.
    > OS 4.5.x / Curve 8330 using the Smartphone Blackberry 2.9.0.52 Simulator

    2. the version of BlackBerry JDE or BlackBerry JDE component Package used to build the application.
    > Eclipse 3.5.1 version identifier: 20090920-1017; BlackBerry Java plug-in Version: 1.1.1.200911111641 - 15; BlackBerry Java SDK version 4.5.0.21

    3. the exact error, an exception or a behavior that you are experiencing. Try to avoid statements like "it doesn't work".

    > Thread stack:

    Thread [CarMinderBB (122) id = 1149878272] (Suspended (exception IllegalStateException))
    AddCarScreen (Field) .assertLayoutComplete () line: 717
    Screen$ ScreenFieldVisitor.Visit (field, int) line: 5118
    AddCarScreen (Manager) .acceptVisitor (FieldVisitor) line: 400
    AddCarScreen (Screen) .assertLayoutCompleteOnScreen () line: 402
    AddCarScreen (Screen) .doLayout () line: 958
    UiEngineImpl.pushScreen (Screen) line: 671
    CarMinder (UiApplication) .pushScreen (Screen) line: 291
    CarMinder. (line): 54
    CarMinder.main (String []) online: 82

    4. If possible, the line of code that triggers the error or exception, as well as an excerpt from the preceding code.

    If {(cars.isEmpty ())}
    pushScreen (new AddCarScreen (true));  CarMinder.java online: 291
    } else {}
    pushScreen (new CarMinderScreen());
    }

    ****************

    public class addcarscreen extends screen implements {FieldChangeListener}

    public AddCarScreen (Boolean test) {}
    LabelField newscreen is new LabelField ("Simple tags");.
    Add (newscreen);
    }

    }

    As you can see, I do not have a complicated code path, but I am unable to discern why that IllegalStateException is thrown.  Of research forums, the possibility of adding to the Manager after pushing the screen has been raised, but it seems that the error here is thrown before the AddCarScreen object is fully built, so I don't think it's on the stack of the screen (but I could be wrong!).

    Given that most of the stack trace involved code of the RIM, I don't have access to determine what she wants.  Any help would be most appreciated.

    I always get java and c ++, but "this" passing of a ctor can create confusing results.

    You do not have the source code, but you can scroll through this kind of thing and look at the fields. Things 'assert '.

    are several checks and the name, looks like he's complaining about the State of the page layout.

    You outweighs dolayout?

    I remember if you go through you will find (many LOL) "asseertEventThread" or something similar with

    the name being called on some operating systems.

  • Add a field to a screen more than once

    Hey. I just want to add the same field on the screen several times without IllegalStateException (which means that the field already has a Manager). The code is as simple as myScreen.add (myfield); several times. Workaround solution? See you soon

    I guess it's just considered same hokey...

    for (int i = 0; i)< m_feeds.length;="" i++)="">
    SRSS_OLF myOLF = (SRSS_OLF) m_everyOLF.elementAt (i);
    If (myOLF.getManager ()! = null) {}
    Manager m = myOLF.getManager ();
    m.Delete (myOLF);
    }
    m_stunningRSSMainScreen.Add (myOLF);  myOLF is an extended ObjectListField
    }

  • Information update screen problem

    Hi all

    I'm having a problem with the network function.

    What I am tring to do is:

    (1) make http every second call up to meet certain condition - it works very well.

    (2) display information popupscreen whenever the call over http but this one gets displays the last time only.

    not displaying no not every second. So I can't show processing status, but it shows only one result.

    (3) here is my code. (Sorry for the ugly code.)

    Please help me find a solution for this.

    Thank you.

    Calling method:
        public int makeCallLoop()
        {
            boolean running=true;
            int statusCode;
            int result = this.SUCCESS;
            StringBuffer sb = new StringBuffer("Making call");
    
            while (running)
            {
                connThread = new ConnectionThread();
                connThread.start();
                connThread.post(Globals.blaster_url, "action_type=" + Globals.ACT_TYPE_BLASTER_CALL_STATUS + "&" +
                        "uid=" + uid + "&sessionid=" + sessionId + "&list="+getStatusData());
                while (connThread.sending) {
                    try {
                        //Status.show( sb.append(".").toString() );
                        Thread.sleep(1000);//100
                    } catch (Throwable e) {
                        connThread.stop();//Dk 090708
                        System.out.println("----------------makeCallLoop(), connThread Sleep exception: " + e);
                        Status.show( "Please try again." );
                                     }
                }
    
                if (connThread.httpRespCode== HttpConnection.HTTP_OK) {
                    JSONParser jparser = new JSONParser();
                    statusCode = jparser.parseBlasterGetStatus(Globals.receivedContent);
    
                    uid = jparser.uid;
                    sessionId = jparser.sessionId;
                    if (statusCode == 0)
                    {
                        running = false;
                        result = this.SUCCESS;
                        search_no = jparser.search_result;
                        //Status.show("We got some answers for you." + "- www.heycosmo.com -");
                        BlasterCallStatus();
    -----
    ---
        //Display Blaster call status
        private void BlasterCallStatus()
        {
            VerticalFieldManager manager = new VerticalFieldManager(VERTICAL_SCROLL| VERTICAL_SCROLLBAR |
                     Field.FIELD_HCENTER|Field.USE_ALL_WIDTH)
            {
                protected void sublayout(int width, int height)
                {
                    super.sublayout(Display.getWidth()-20,Display.getHeight()-25);
                    setExtent(Display.getWidth()-20, Display.getHeight()-25);
                    setPosition(0,0);
                }
            };
            VerticalFieldManager headerMgr = new VerticalFieldManager();
            _popupMenu = new PopupScreen(manager, DEFAULT_CLOSE|PopupScreen.VERTICAL_SCROLL)
            {            // popup screen methods are here     };
            cnt=0;
    
            LabelField nullLabel0 = new LabelField(" ", LabelField.NON_FOCUSABLE)
            {
    
            };
            BitmapField liveCallStat = new BitmapField(BlasterMain.middle_off, BitmapField.FOCUSABLE|BitmapField.FIELD_VCENTER)
            {
    
                public void onUnfocus(){
                     if(liveCallStatB)
                        setBitmap(BlasterMain.middle_on);
                    else
                        setBitmap(BlasterMain.middle_off);
                    invalidate();
                    super.onUnfocus();
                }
            protected void paint(Graphics g)
            {
             }
            };
    
            headerMgr.add(nullLabel0);
            headerMgr.add(liveCallStat);
            manager.add(headerMgr);
    
            LabelField [] list = new LabelField[search_no];
    
                {
                JSONParser jparser = new JSONParser();
                int status = jparser.parseBlasterGetStatus(Globals.receivedContent);
                search_no = jparser.search_result;
    
                Enumeration keys = jparser.rowObj.keys();
    
                //iterate through each key and get the respective value
                phoneInfo = new String [jparser.row.size()];
                cnt=0;
    
                while(keys.hasMoreElements())
                {
                    String key = keys.nextElement().toString();
    
                try {
                phoneInfo[cnt]= jparser.rowObj.getString(key);
                } catch (JSONException e) {
        Status.show("You received wrong data format, please try again.");
                }
                        subStr = Utils.split(phoneInfo[cnt], "|");
                        phone = subStr[1];
                    .....                list[cnt] = new LabelField (subStr[0], LabelField.FOCUSABLE|
                            LabelField.FIELD_HCENTER|LabelField.USE_ALL_WIDTH)
                    {
                        ....
                        public void paint(Graphics g) {
    
                            XYRect xy = g.getClippingRect();
                            if(xy.y < 0)
                            {
                                throw new IllegalStateException("Clipping rectangle is wrong.");
                            }
                            String [] subStr;
                            //String phone = ;
                            int startLine=1;
    
                            g.setFont(f12b);
                            g.setColor(0xffffff);
                            g.drawText(this.getText(), 0, 0);//Name
    
                            g.setColor(0x425173);
                            g.setFont(f12b);
                            g.drawText(phone, 2, 13);//Phone number
    
                            g.setFont(f);
                            g.drawBitmap(Display.getWidth()-20-optionImg.getWidth(), 0, optionImg.getWidth(), optionImg.getHeight(), optionImg, 0,0);
                            g.setColor(0x0054a6);
                            g.drawText(callStatus,
                                Display.getWidth()-20-optionImg.getWidth()+ (optionImg.getWidth()-f.getAdvance(callStatus))/2,
                                startLine*optionImg.getHeight());
                            super.paint(g);
                        }
                    };
                        manager.add(list[cnt]);
                    cnt++;
                }
                //manager.add(listMgr);
                UiApplication.getUiApplication().pushScreen(_popupMenu);
                //bodyMgr.add(listMgr);
            }
        }
    

    To begin with, if this loop is running several times, that you should not show a bunch of pop-up screens every second.  Each shortcut screen creates its own thread, which can cause you problems.

    What is - TooManyThreadsError
    Article number: DB-00474

    http://www.BlackBerry.com/knowledgecenterpublic/livelink.exe/fetch/2000/348583/800451/800783/What_Is...

    Note that IO connections must be made in its own thread.

    Support - Application stops responding when you open a connection
    Article number: DB-00159

    http://www.BlackBerry.com/knowledgecenterpublic/livelink.exe/fetch/2000/348583/800451/800563/support...

    If your application runs in the background, see this link:

    How - to alert a user to a background application
    Article number: DB-00407

    http://www.BlackBerry.com/knowledgecenterpublic/livelink.exe/fetch/2000/348583/800332/800505/800608/...

    If she runs first plan, check out this link:

    How - to upgrade a screen on the main event Thread
    Article number: DB-00136

    http://www.BlackBerry.com/knowledgecenterpublic/livelink.exe/fetch/2000/348583/800332/800505/800256/...

  • is authorized to build the screen over the events, but push over the event

    Hi all, I know it's a lame question, but I get an error message and now then guess myself

    the way I coded this app. I usually build screens in a non event, calling thread

    Add when adding fields and all the UI stuff, but once it is done, then I put the pushScreen

    in the case of threading

    is it ok?

    Well, it is certainly not a "lame".  I guess you can add fields to a form on a thread of non-event so the screen is not "displayed" (do not push in the battery of the screen still), otherwise, you will need to run that add inside invokeLater or while now the lock of the event.

    Say, if you pushScreen (MyCustomBackgroundCreatedScreen()) new, some of the screen building code can be executed before the screen is actually pushed and the rest will be executed after that.  The "suite" party (whose actual start is quite random) will throw IllegalStateException unless you put your add code (...) within invokeLater or synchronize the lock of the event.

    I did it myself - parses an XML file in a separate Thread and by creating and adding fields one by one to a display manager - and I distinctly remember having to do it the way I described.

    If it's OK or not depends on your design.  If you have only a few fields to add, that's fine, I guess.  Each addition will cause the entire screen to rearrange, which is a small performance decrease. However, unless you have a few fields of thousands (I remember this post here in the forum), you should not notice a significant slowdown.

  • Add the layout at the top of the screen (under the banner) Manager

    Hello

    Im trying to put two labels with a background image under the banner of the screen.

    Can I set an as a banner of the screen layout manager?

    Copy the code next survey IllegalStateException.

    TableLayoutManager timerBtnManager = new TableLayoutManager
    (new int [] {TableLayoutManager.SPLIT_REMAINING_WIDTH,
    TableLayoutManager.SPLIT_REMAINING_WIDTH},
    (TableLayoutManager.FIELD_LEFT, true);

    timerBtnManager.add (currentQuestionNumberLabelField);
    timerBtnManager.add (timerLabel);

    Add (timerBtnManager);
    setBanner (timerBtnManager);

    Thank you

    adrianeireyahoo wrote:

    Hello

    Im trying to put two labels with a background image under the banner of the screen.

    Can I set an as a banner of the screen layout manager?

    Copy the code next survey IllegalStateException.

    TableLayoutManager timerBtnManager = new TableLayoutManager
    (new int [] {TableLayoutManager.SPLIT_REMAINING_WIDTH,
    TableLayoutManager.SPLIT_REMAINING_WIDTH},
    (TableLayoutManager.FIELD_LEFT, true);

    timerBtnManager.add (currentQuestionNumberLabelField);
    timerBtnManager.add (timerLabel);

    Add (timerBtnManager);
    setBanner (timerBtnManager);

    Thank you

    See the code highlighted in red? That's your problem. I bet your IllegalStateException said something on a field "already apparent. Do not add your manager on the screen at all - defining it as banner adds to the hidden screen banner Manager. So remove the code highlighted, and you should be fine.

  • Close popup screen programmatically

    I have a popup screen that I displayed to inform the user that they are wating on entry. When I try to close it in my earpiece method it gives the error:

    IllegalStateException - UiEngineImpl.assertHaveEventLock)

    I push the pop-up screen on the stack using a runnable.invokeAndWait and push as a ModalScreen because otherwise it will not show.

    What is the error of assertHaveEventLock for, and why the window display not using invokeLater and pushScreen?

    The IllegalStateException is thrown because the thread that calls the close method (the listener) is not the thread main event.  Calling the method close must occur in a block, as described on the next page.

    How - to upgrade a screen on the main event Thread
    Article number: DB-00136

    http://www.BlackBerry.com/knowledgecenterpublic/livelink.exe/fetch/2000/348583/800332/800505/800256/...

  • pushing screens, help?

    OK, so I looked through the API a bunch. I searched Google a lot. I searched these forums a lot. I have accumulated my mind a lot lol. I finally give up and ask for help

    I create an application that pushes the first screen has buttons on them. the buttons use a CustomField class that extends BitmapField. I have replace the trackWheelClick function which then pushes a new screen with...

    UiApplication.getUiApplication().pushScreen(new HomeScreen());
    

    (Home screen is a class that extends the screen)

    and of course I get IllegalStateException. and I know that its in the EventDispatcher wire because I called...

    if(UiApplication.getUiApplication.isEventDispatchThread())
    {
        Dialog.Alert("yup");
    }
    

    which returns a dialog "Yes."

    I'm confused... any help, advice, suggestions, etc. is very much appreciated!

    you were right, it did not work. He was demanding it as a static variable as well. and I understood why after reading of the definition of a static variable

    but you certainly have the solution here with the vector! Just do a public static vector (I will only need/want 1) filled with clocks and then I passed the clock function setClock

    overall, you are the best thank you very much Peter for putting in place with my ignorance and new problems

  • Using screens of the child within an Application

    Hello

    I'm developing my first Blackberry application and I'm trying to set up a kind of a tab page layout where a user would click on one of the 3 buttons on a bar of buttons at the bottom of the screen and a special screen based on the clicked tab or the button.

    That's how I'm currently trying to achieve

    I have a MainWindow() stretching screen that I add to the request.  I added a HorizontalFieldManager to this window I add 3 buttons.  Currently, it appears at the top of the screen, but finally, I would like to have it on the bottom of the screen.  In fact, I wish it were exactly like button bars, you see in the last OS you see on the screen of e-mail inbox.  Is it possible to use a built-in component of blackberry to have my buttons custom like this?

    I created 3 screens that extend the screen containing the appropriate for each particular form fields:

    -DataSubmissionScreen()

    -ReportingScreen()

    -PreferencesScreen()

    When a user clicks on a button, I want to add the relevant display in the remaining space in the MainWindow remaining after the button bar has been added.  However, whenever I try to add a screen MainWindow I get an IllegalStateException error when the program is launched.

    How can I get this feature of child screen on the Blackberry?  It would be more logical for my child 'screens' actually extend FieldManager instead of the screen and add THOSE of MainWindow?

    Thank you

    Mike

    There is no concept of a "child monitor" in Blackberry. There is a single stack screen, and the screen at the top of the stack, period.

    You can push a screen on the stack, it becomes the top of the screen and appears.

    When you jump a screen, the following in the stack screen (if there is one). If you skip the last battery screen, your application will end (unless you plan to do this and avoid it).

    Perhaps this article will provide a few ideas:

    http://www.BlackBerry.com/knowledgecenterpublic/livelink.exe/fetch/2000/348583/800332/800505/800508/...

  • A pop-up screen that will be unveiled later closing

    Here's the basic idea. I have Ecranun, where the user can select a button... After the selection, ScreenB (a popup) is pushed, where the user chooses between suboptions. After choosing, they return to Ecranun. If they choose another screenB button should show again. However, whenever I try to reshow screenB I get illegalStateException.

    I think my problem is that I am not closed screenB correctly (the methods I've tried, I wrote at the end of the code). Here is an example of code that has the idea base down.

    /*
     * Test.java
     */
    package test;
    
    import net.rim.device.api.ui.Field;
    import net.rim.device.api.ui.FieldChangeListener;
    import net.rim.device.api.ui.UiApplication;
    import net.rim.device.api.ui.component.ButtonField;
    import net.rim.device.api.ui.container.MainScreen;
    import net.rim.device.api.ui.container.VerticalFieldManager;
    
    public class Test extends UiApplication
    {
        private FieldListener listener = new FieldListener();
        public static TestScreen testScreen;
    
        public static void main (String args[])
        {
            Test app = new Test();
            app.enterEventDispatcher();
        }
    
        public Test()
        {
            //display a new screen
            testScreen = new TestScreen();
            UiApplication.getUiApplication().pushScreen(testScreen);
        }
        ButtonField bf1 = new ButtonField(
                "Hello World",ButtonField.CONSUME_CLICK);
    
        public class TestScreen extends MainScreen
        {
            public TestScreen()
            {
                super();
                VerticalFieldManager vfm =
                    new VerticalFieldManager();
                bf1.setChangeListener(listener);
                add(bf1);
                add(vfm);
            }
        }
        class FieldListener implements FieldChangeListener
        {
            public void fieldChanged(Field button, int context)
            {
                TestPopupScreen.popup = new TestPopupScreen();
                UiApplication.getUiApplication().pushScreen(
                        TestPopupScreen.popup);
            }
        }
    
    }
    
    /*
     * TestPopupScreen.java
     */
    package test;
    
    import net.rim.device.api.ui.Field;
    import net.rim.device.api.ui.FieldChangeListener;
    import net.rim.device.api.ui.UiApplication;
    import net.rim.device.api.ui.component.ButtonField;
    import net.rim.device.api.ui.container.PopupScreen;
    import net.rim.device.api.ui.container.VerticalFieldManager;
    
    public class TestPopupScreen extends PopupScreen
    {
        public static TestPopupScreen popup;
        private static VerticalFieldManager vfm =
            new VerticalFieldManager();
        private FieldListener listener = new FieldListener();
    
        public TestPopupScreen()
        {
            super(vfm,Field.FOCUSABLE);
            ButtonField bf = new ButtonField(
                    "Hello Again",ButtonField.CONSUME_CLICK);
            bf.setChangeListener(listener);
            add(bf);
        }
    
        class FieldListener implements FieldChangeListener
        {
            public void fieldChanged(Field button, int context)
            {
                //What is the proper way to close the screen so it
                //can be relauched later?
    
                //popup.close();// IllegalStateException
    
                //UiApplication.getUiApplication().popScreen(popup);
                //gives IllegalStateException
    
                /*
                 * RuntimeException
                 * UiApplication.getUiApplication().pushScreen(Test.testScreen);
                 * UiApplication.getUiApplication().popScreen(popup);
                 */
    
            }
        }
    }
    

    Thank you in advace for all help. It's very appreciated.

    Take care

    kentt

    I find your problem. the main reason was for your problem is that you can not push more than once the same screen object onto the stack. When you click the second Hello World button you push the first screen again to show that.this is wrong. You can not do that... I enclose the code.

    test of the package;

    Import net.rim.device.api.ui.Field;
    Import net.rim.device.api.ui.FieldChangeListener;
    Import net.rim.device.api.ui.UiApplication;
    Import net.rim.device.api.ui.component.ButtonField;
    Import net.rim.device.api.ui.container.MainScreen;
    Import net.rim.device.api.ui.container.VerticalFieldManager;

    public class Test extends UiApplication
    {
    private FieldListener listener = new FieldListener();
    public static TestScreen testScreen;
        
    Public Shared Sub main (string args [])
    {
    App test = new Test();
    app.enterEventDispatcher ();
    }
        
    Public test()
    {
    a new screen
    testScreen = new TestScreen();
    UiApplication.getUiApplication () .pushScreen (testScreen);
    }
    ButtonField bf1 = new ButtonField ("Hello World", ButtonField.CONSUME_CLICK);
        
    SerializableAttribute public class TestScreen extends screen
    {
    public TestScreen()
    {
    Super();
    VFM VerticalFieldManager = new VerticalFieldManager();
    Bf1.setChangeListener (Listener);
    Add (Bf1);
    Add (VFM);
    }
    }
    Class FieldListener implements FieldChangeListener
    {
    ' Public Sub fieldChanged (field button, int context)
    {
    TestPopupScreen.popup = new TestPopupScreen();
    UiApplication.getUiApplication () .pushScreen (TestPopupScreen.popup);
    }
    }
    }

    /////////////

    test of the package;

    test import. Test.FieldListener;
    Import net.rim.device.api.ui.Field;
    Import net.rim.device.api.ui.FieldChangeListener;
    Import net.rim.device.api.ui.UiApplication;
    Import net.rim.device.api.ui.component.ButtonField;
    Import net.rim.device.api.ui.container.PopupScreen;
    Import net.rim.device.api.ui.container.VerticalFieldManager;

    SerializableAttribute public class TestPopupScreen extends PopupScreen
    {
    public static TestPopupScreen popup.
        
    public TestPopupScreen()
    {
    Super (new VerticalFieldManager (), Field.FOCUSABLE);
    ButtonField bf = new ButtonField ("Hello Again", ButtonField.CONSUME_CLICK);
    bf.setChangeListener (listener);
    Add (BF);
    }
    FieldChangeListener listener = new FieldChangeListener()
    {
    ' Public Sub fieldChanged (field field, int context) {}
          
    UiApplication.getUiApplication () .popScreen ();
            
    }
    };

    }

  • Problem at the opening of the start screen

    Hello

    In my BB app, I want first of all to display a splash screen and then go to the normal screen. To do this in my main Uiapplication, I call you:

    SerializableAttribute public class MyAppStarts extends UiApplication {}

    public MyAppStarts() {}
    pushScreen (new SpalshScreen());
    }
    Public Shared Sub main (String [] args) {}
    MyAppStartsapp = new MyAppStarts();
    app.enterEventDispatcher ();
    }

    }

    It's my inspired SplashScreen (excerpt) of http://www.blackberry.com/knowledgecenterpublic/livelink.exe/fetch/2000/348583/800332/800505/800256/...

    version 4.2 or later

    public class SplashScreen extends full screen {}
    private Minu = new Timer();
    private bitmap Bitmap;
    private UiApplication app;
           
    public SplashScreen() {}
    Super(Field.USE_ALL_HEIGHT |) Field.FIELD_HCENTER);
    System.out.println ("* in SplashScreen");
    try {}
    bitmap image = Bitmap.getBitmapResource ("flash.png");
    } catch (Exception e) {}
    System.out.println ("* Exception:" + e.getMessage ());
    e.printStackTrace ();
    }
    This.App = ui;
    This.Add (new BitmapField (bitmap));
    SplashScreenListener listener = new SplashScreenListener (this);
    this.addKeyListener (listener);
    Timer.Schedule (new CountDown(), 5000);
    System.out.println ("display of splash...");
    UiApplication.getUiApplication () .pushScreen (this);
    }
           
    public void dismiss() {}
    Timer.Cancel ();
    UiApplication.getUiApplication () .popScreen (this);
    UiApplication.getUiApplication () .pushScreen (new LoginScreen());
    }
           
    the class Countdown
    private class timer extends TimerTask {}
    public void run() {}
    Thread DismissThread = new DismissThread();
    UiApplication.getUiApplication () .invokeLater (thread);
    }
    }
           
    class DismissThread
    private class DismissThread implements Runnable {}
    public void run() {}
    dismiss();
    }
    }

    class SplashScreenListener
    NotInheritable public class SplashScreenListener implements KeyListener {
    SplashScreen screen private;
    {} public boolean keyChar (key char, int status, int time)
    intercept the key ESC and MENU - exit the splash screen
    Boolean retval = false;
    switch (key) {}
    case Characters.CONTROL_MENU:
    case Characters.ESCAPE:
    Screen.dismiss ();
    retval = true;
    break;
    }
    Return retval;
    }
    {} public boolean keyDown (keycode, int, int times)
    Returns false;
    }
    {public boolean keyRepeat (keycode int, int times)
    Returns false;
    }
    {public boolean keyStatus (keycode int, int times)
    Returns false;
    }
    {} public boolean keyUp (keycode int, int times)
    Returns false;
    }
    public SplashScreenListener (SplashScreen splash) {}
    screen = splash;
    }
    }

    protected boolean navigationClick (int status, int time) {}
    dismiss();
    Returns true;
    }
       
    protected boolean navigationUnclick (int status, int time) {}
    Returns false;
    }
       
    protected boolean navigationMovement (int dx, int dy, int, int time status) {}
    Returns false;
    }
          
    }

    She throws IllegalStateException - does not know where. I tried to add the breakpoint at the pushScreen of the main class (new SplashScreen()); but it throws the exception and could not know where the exception. If I replace the SplashScreen with LoginScreen, it works perfectly. There is something wrong with the SplashScreen.

    Can anyone help mw know where I'm going wrong or what more to do!

    Any help is very appreciated.

    Thank you

    Oh thanks for pointing this error.

    After correcting this error also, it did not work at all. Finally I erased applications for download folder (could also just delete my those cirrent requests) and tried again and it worked perfectly.

    I guess the main problem is also the same application was already in the download folder was running even JDE and proper application in the cache to perform instead of newly added or updated to date.

    Just to see the results with invoking pushScreen again n SpashScreen Builder - resutls were still only works correctly. Not a Sunrise errors/exceptions or screen showed two times or more - everything worked as expected. Hmm strange.

    Any ways thanks.

Maybe you are looking for

  • Update iTunes to 12.4 Dungeon appearing, even if I

    For several months now, iTunes will be periodically instruct me to update to v. 12.4, even if my current version is 12.4.2 (see screenshot below).  Whenever I run across the update and it ends without problem.  But a few weeks later, the same update

  • HP - 15-ac600ur: some drivers not installed

    Hello Sorry for my English. Some drivers has not been installed correctly. Download all the drivers from the link: http://support.HP.com/ru-ru/drivers/selfservice/HP-15-AC100-notebook-PC-series/8499326/model/9728679... But when installing the chipset

  • TECRA M9 - drivers Vista x64bit

    Can anyone help to track down these x 2 required x 64 bit drivers for Windows Vista? The Device Manager console tree Vista requires the following (unknown drivers) which are actually (1) TOSHIBA HDD Protection - sensor shock (driver for Vista x 64) (

  • Hosting to my own area of suit with Business Catalyst

    As a member of the CC, if I create websites with Adobe Muse, I can host my own domain of suit with Business Catalyst for free and if so, how much can I make?

  • How can I re install my creative cloud cc illustrator

    My illustrator was not opening so I deleted try to re install but now I can't re install because it is on and it says "up to date". How can I re install my creative cloud? I even tried to re download it from the same site, but nothing happens.