Closed kryakushin666 closed 2 years ago
You can save Marker Location in ViewModel
"The Best Way" to handle the applications each has an activity which has Maps, is to make that activity Singleton. It means you can constraint that activity to JUST ONE TIME INSTANTIATE and so that just once this activity creates and because of that it doesn't make a problem about instantiating again it. So I can say the solution is abbreviated in this step: 1- Make the Activity Singleton
And the code is as bellow: Android Studio -> app -> manifests -> AndroidManifest.xml
As show in the picture, you should add bellow code to your Map Activity at Manifest
android:launchMode="singleTask"
It will make that Activity instantiate just once and so your app just loads the map once and because of that the state of the application in the process of moving between different activities (and as you said Screens) save.
Because of that the problem will be fixed and all states of the application saved, So if you change the screen, you will stay in the same place after you return to Map Activity.
The last thing about this problem is about the Location. In this case the Last Location of your Map will be saved and if you come back to this activity, there will be no problem about that!
can i work on this issu ?
this is my first contribution
Hello, I use google maps api and I want to save map instance, because everytime I go to another screen and back, the map is updated instead of staying in the same place, because of this, there is a big cheat of opening times. How I can fix this?