Hi,
I am trying to use a MapComponent on two different MainScreen classes (Blackberry API). The MapComponent is instantiated locally to each screen. The problem that I'm running into is if I instantiate the one MapComponent in MainScreen class #1, then try to instantiate a MapComponent in MainScreen class #2, I receive an IllegalThreadStateException error message. I tried using StopMapping, but then if I go back to the same screen again, the map doesn't work since I stopped it's operation. Is there a proper way to deal with this problem? The only other thing I could think of trying would be to create a singleton with the MapComponent and keep sharing it everywhere.
Any thoughts?
Thanks,
Eric
Jaanus,
Thanks. I implemented the MapComponent in a singleton and it is working well without receiving the IllegalStateException error.
Regards,
Eric
Hi eborisow,
How to implement Map component in a singleton
send me sample code..
With current library implementation the best options is really to use one map component instance throughout whole application because some core implementation is statically shared.
If there is not a lot of screens switching, then other option would also be just creating/destroying screen specific map component instance on screen show/hide. But this is going to add some unneeded map creation/initialization/deinitialization overhead.