10-14-2008 11:29 AM
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?
10-14-2008 02:30 PM
10-14-2008 02:42 PM
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.
10-15-2008 10:40 AM
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.
10-15-2008 01:12 PM
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.