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
Developer
Posts: 144
Registered: ‎03-15-2011
My Device: blackberry smart phone
My Carrier: Airtel
Accepted Solution

getting control over pushing screen globally from background process

Hello all i want to control on pushing the screen globally from background application. currently i made a Screen which is extending MainScreen. I want to show this screen globally. I am using

 

pushGlobalScreen(Screen to push, int priority, flag); its working if there is two screen it showing one after other. But what i want to do actually is. I want to close the first screen then i want to show the next screen and so on . So how to acheive this. Please help me

Developer
Posts: 17,012
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport
My Carrier: O2 Germany

Re: getting control over pushing screen globally from background process

push the next screen first, then close the previous one. this way you always have a screen displayed.
----------------------------------------------------------
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
Posts: 144
Registered: ‎03-15-2011
My Device: blackberry smart phone
My Carrier: Airtel

Re: getting control over pushing screen globally from background process

no that is not how i want. I want to hold the second screen if there is a screen pushed globally on display stack if user close that screen then i want to push the new screen .
Developer
Posts: 17,012
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport
My Carrier: O2 Germany

Re: getting control over pushing screen globally from background process

is the global screen your own? or a random one from another application?
----------------------------------------------------------
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
Posts: 144
Registered: ‎03-15-2011
My Device: blackberry smart phone
My Carrier: Airtel

Re: getting control over pushing screen globally from background process

[ Edited ]

its my own ... can i provide some snippet of code....

I am explaining the whole scenario I am checking in the database for the time if current time matches with the alarm time then it pushes the screen let suppose there is more than one alarm is saved for the same time.

while (Cheking into database for time){

 

if (databasetime == current time ) {// let suppose there is more than one alarm save for the same time

synchronized (getEventLock()) {// This will call one after other but i want to first

UiEngine ui = Ui.getUiEngine();

ui.pushGlobalScreen(new AlarmScreen() , 1, UiEngine.GLOBAL_QUEUE);// Here i want to stop to user to close the screen then i want to push again the screen.

}

}

}

I think my requirement is clear now.  is it?? if not i can explain it again.

Developer
Posts: 144
Registered: ‎03-15-2011
My Device: blackberry smart phone
My Carrier: Airtel

Re: getting control over pushing screen globally from background process

and one more question can i use ui.pushModalScreen(Screen screen); instead of ui.pushGlobalScreen(new AlarmScreen() , 1, UiEngine.GLOBAL_QUEUE); will it push the screen globally from background application if my gui application is not running.
Developer
Posts: 17,012
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport
My Carrier: O2 Germany

Re: getting control over pushing screen globally from background process

if you push modal you can just continue after the call, as it blocks until the screen is released.

otherwise give the alarmscreen a reference to your own screen (a callback) so that your screen is notified.
----------------------------------------------------------
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
Posts: 144
Registered: ‎03-15-2011
My Device: blackberry smart phone
My Carrier: Airtel

Re: getting control over pushing screen globally from background process

if will use pushModalScreen (); then will it work i think it will ask for the event thread is it ?? And my application is currently not running only my backgroundApplication is running so can you tell me. Am i able to use this method in this scenario ???
Developer
Posts: 19,636
Registered: ‎07-14-2008
My Device: Not Specified

Re: getting control over pushing screen globally from background process

[ Edited ]

pushModalScreen does not apply to Global screens.  You need the GLOBAL_MODAL flag.

 

That said, you really should only be using Global screens to alert the user to problems.  They are not intended to be used for application processing and will behave differently to normal screens (for example you will struggle to get menus).

 

I think in this situation, if you do only want to have one alarm screen on display at a time, you will need to keep a reference to the pushed Alarm screen to save you pushing another one.  You will have to use the closing of this screen to check for and display other alarms that have been generated since this was displayed.  If no other alarms are due, then the reference can be removed so your background application is free to push a new Global screen. 

Developer
Posts: 144
Registered: ‎03-15-2011
My Device: blackberry smart phone
My Carrier: Airtel

Re: getting control over pushing screen globally from background process

[ Edited ]

@peter_strange okk so is there any way i can achieve this scenario

while(cursor.next()){
if (databasetime == current time ) {// let suppose there is more than one alarm save for the same time synchronized (getEventLock()) { UiEngine ui = Ui.getUiEngine(); ui.pushGlobalScreen(new AlarmScreen() , 1, UiEngine.GLOBAL_QUEUE);// Here i want to stop and want user to close the screen then i want to push again the screen. } } }