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
Developer
Posts: 283
Registered: ‎07-22-2008
My Device: Not Specified

getActiveScreen() not returning globalScreens

I am using the getActiveScreen() to find out the type of  screen that is currently on top of the stack ( i.e. displayed).

When I use a global screen ( i.e. screen that that is displayed using pushGlobalScreen()), the getActiveScreen() does not detect it.

Is this the normal behavior?

If so, how can I detetct that there is a globalScreen() being displayed?

 

Thanks

 

 

 

 

 

 

 

 

 

 

 

 

 

 

BlackBerry Development Advisor
Posts: 15,753
Registered: ‎07-09-2008
My Device: BlackBerry PRIV
My Carrier: Bell

Re: getActiveScreen() not returning globalScreens

Can you describe the scenario you are working with?  Are you trying to determine if there is a screen shown on top of your application screen?
Mark Sohm
BlackBerry Development Advisor

Please refrain from posting new questions in solved threads.
Problem solved? Click the Accept As Solution button.
Found a bug? Report it using Issue Tracker
Developer
Posts: 19,636
Registered: ‎07-14-2008
My Device: Not Specified

Re: getActiveScreen() not returning globalScreens

Further to Mark's response (and I'm interested in your answers to his questions):

1) This is normal behaviour, getActiveScreen only returns screens within the application being executed when the call is made.

2) If your application displayed the global screen, then you can use the isDisplayed() method on that screen, but I think that actually only proves it is on the display stack, it doesn't actually prove it is the currently displayed screen.

Developer
Developer
Posts: 283
Registered: ‎07-22-2008
My Device: Not Specified

Re: getActiveScreen() not returning globalScreens

Here is the scenario:

 

The application try to connect using TCP, but the connection fails because the APN is not set. It then prompts the user using a global screen. So the application itself is displaying the global screen.

But this process may be repeated many times, so we end up poping a lot of these screens, if the user did not respond immediately.

So, the solution to this is to check, before poping the global message, if there is already a global screen of this type on display. If so do not display a new one. This way I will end up with a max of one global screen displayed. This is where I used getActiveScreen() and check its type.

Theoretically, the application pops the screen, so the getActiveScreen() should detect it. This is not happening.

 

Well the other solution is to keep a global pointer to this global screen and check the pointer to see if there is a screen or not.

But the first approach seems to be cleaner as this may be triggered in different places.

 

Thanks

 

BlackBerry Development Advisor
Posts: 15,753
Registered: ‎07-09-2008
My Device: BlackBerry PRIV
My Carrier: Bell

Re: getActiveScreen() not returning globalScreens

I recommend tracking this within your application.  Note that higher priority screens could be placed on top of yours, so this isn't a valid test.

 

You could store a variable in the RuntimeStore that your application updates whenever your screen is pushed or popped.

Mark Sohm
BlackBerry Development Advisor

Please refrain from posting new questions in solved threads.
Problem solved? Click the Accept As Solution button.
Found a bug? Report it using Issue Tracker