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
Developer
ashish12169
Posts: 214
Registered: ‎03-18-2012
My Device: 8520

Unable to pop( popUpScreen) which is pushed globally with UI.getUIEngine

Sir,

        I have a popupScreen and i pushed it globally  and after 5 sec i want to  popup this screen automatically......

but it does not work...below is the code...

 

        

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

                   Ui.getUiEngine().pushGlobalScreen(PopupScreen, 2,UiEngine.GLOBAL_MODAL);
                    try
                    {
                        Thread.sleep(5000);
                    }
                    catch (InterruptedException e)
                    {
                        // TODO Auto-generated catch block
                        e.printStackTrace();
                    }
                    Ui.getUiEngine().popScreen(PopupScreen);
               }

Developer
simon_hain
Posts: 16,282
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport

Re: Unable to pop( popUpScreen) which is pushed globally with UI.getUIEngine

don't use thread.sleep, it blocks the UI thread.
you can use a timertask+timer, or use invokelater with a time value.
----------------------------------------------------------
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
@SimonHain on twitter
Developer
RexDoug
Posts: 4,764
Registered: ‎07-21-2008
My Device: Not Specified

Re: Unable to pop( popUpScreen) which is pushed globally with UI.getUIEngine

[ Edited ]

Another approach might be to extend PopScreen and put the timer thread inside of the class. You can start the thread before pushing the screen and the have the thread automaticaly close the screen when the time expires.

 

Developer
ashish12169
Posts: 214
Registered: ‎03-18-2012
My Device: 8520

Re: Unable to pop( popUpScreen) which is pushed globally with UI.getUIEngine

please, share the code ,how i can use this....

Developer
smiley
Posts: 1,497
Registered: ‎07-14-2008
My Device: Z10

Re: Unable to pop( popUpScreen) which is pushed globally with UI.getUIEngine

[ Edited ]

try this

 

UiApplication.getUiApplication().invokeLater(new Runnable()
{
    public void run()
    {
        Screen _screen = new Dialog( "Test Dialog:",new String[] {"OK", "Cancel"}, new int[] {0,1},1,null);           
        Ui.getUiEngine().pushGlobalScreen(_screen, 1, UiEngine.GLOBAL_MODAL);


    }
}, 5000, false);