05-20-2011 10:20 AM
I have a screen in my app with a custom button which opens a modal screen containing a BrowserField and a custom BACK button.
The button that opens the screen with the BrowserField does the following:
The back button basically closes the screen:
if(field == backTab)
When I click to open the screen with the BrowserField, it opens and displays the website as expected. When I click the back button on that screen it closes it and goes back to the previous screen as expected.
But if I click to open the BrowserScreen again it gives me an IllegalStateException. What does this mean??
When I hit the back button from the BrowserScreen do I have to do any additional work, such as delete anything??
05-20-2011 11:22 AM - edited 05-20-2011 11:22 AM
Sounds like the screen did not get closed. If you attempt to push the screen again (and it is already on the display stack), you'll get this error.
I don't like the "getUiApplication()" here - depending on the context, this may not retrieve *your* application. Retain a refefence to the screen and close it using this reference (or pop the screen).
05-20-2011 11:54 AM - edited 05-20-2011 11:55 AM
Thanks for the help.
It seems to work ok if I do the following:
if(field == backTab)
I mean, obviously I should not use getUiApplication().getActiveScreen as you mentioned, but now it's not throwing the IllegalStateException.
Is this a good approach???
05-20-2011 12:01 PM
No it's not working.
Sometimes when I click a link on the web page it gives me that same error. It's driving me nuts.
How do I use a BrowserField correctly?? Also it takes so long to load a page, and that's on the simulator, I can only imagine how long it would take on a device then.
Also I can't seem to scroll horizontally, only vertically. So in many cases I can't see the whole page, unless it's a mobile site.
Thanks again for your time.
05-20-2011 01:11 PM
I'm now convinced that it has something to do with the focus.
I just removed my back button and everything works fine. I can click links and everything seems ok. How can I get the BrowserField and my back button to co-exist??