0

I am using heremapslite api for android , recently upgraded into 4.4 , where this Runtime exception started coming up

java.lang.RuntimeException: Only one MapViewLite instance can be created at a time

The real issue is that , when ever i have to start another activity than maps activity, the instance does not gets destroyed (i don't want to finish the activity intentionally as users might want to return) and when the same activity is started again (say for another project or with another configuration) this exception occurs (which wasn't there in the previous version) .been through release notes , find nothing about it, so is there any option to find the existence of an instance of mapviewlite and to destroy it? or is there any other option to remedy it.

PS: I am unable to catch some of the exceptions related , especially with onPause() and onResume() methods.

Harsh
  • 363
  • 4
  • 14

1 Answers1

0

You can call mapViewLite.onDestroy();. Once called, you should be able to create a new MapViewLite instance.

Nusatad
  • 3,231
  • 3
  • 11
  • 17
  • hi , thanks for the time , but as i mentioned earlier what i am lacking is a reference to the existing instance , even obtaining one reference is enough for me , but once my activity is restarted through onCreate(), its gone. because i might be through other activities where onDestroy() isnt called(OnPause is , but never resumes). this problem wasnt there in the previous versions of the api . another thing is the exceptions which wont get caught even in try catch block. – Harsh Jul 23 '20 at 19:15
  • 1
    Maybe instead you can create a plain view / layout that you manually tie to Android's activities (or fragment!) lifecycle hell - to make sure to control the view across activities? If you don't call onDestroy() on the map view, the view will not get destroyed. Another, cleaner way, may be to switch to the Explore or Navigate Editions. These allow multiple map view instances, which will make your use case a lot easier. Or: You can also contact HERE directly, they are very friendly and might add the feature you want in one of the next bi-weekly updates ... – Nusatad Jul 25 '20 at 18:22
  • hi , thanks for the info. i am so new into here i used to love it from OVI or when it was from Nokia, and i thought i should start with lite version at first, now i think i should try slack too.thank you so much. – Harsh Jul 26 '20 at 23:18