Map API

Nutiteq Maps Lib SDK enables developing advanced mobile mapping applications.
Platforms: Android, RIM BlackBerry, Java ME (J2ME)
Download maps API SDK »
Untitled Document

Products

» View demos
» Downloads

Latest news

Last at Tue, 6 Dec 2011 18:37:53
Topic: New BlackBerry sample app
See more news »

How to avoid IllegalThreadStateException

4 replies [Last post]
eborisow
User offline. Last seen 2 years 29 weeks ago. Offline
Joined: 05/19/2009

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

jaanussiim (not verified)

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.

eborisow
User offline. Last seen 2 years 29 weeks ago. Offline
Joined: 05/19/2009

Jaanus,

Thanks. I implemented the MapComponent in a singleton and it is working well without receiving the IllegalStateException error.

Regards,
Eric

venkatesh92
User offline. Last seen 1 year 26 weeks ago. Offline
Joined: 07/22/2010

Hi eborisow,

How to implement Map component in a singleton

send me sample code..