Comments (9)
thanks 💯
from android-samples.
Well it's maybe too late and the problem is solved, but for others with that problem the solution from me can help.
I had the same problem with a laggy map when switching between fragments from navigation in one activity. I think it's a specific way to implement such a structure but anyway.
So the solution for the map to just save the map in its rendered status and don't mess up recreating it when getting back to the fragment, is to check if its not null.
so I use the MapFragment, but you could change your code to fit into it.
In your MainFragment.java you have to check it your actual Map is not null
In the onCreateView Method from Fragment:
if (mMap == null) {
fusedLocationProviderClient = getFusedLocationProviderClient(getActivity());
SupportMapFragment supportMapFragment = (SupportMapFragment) getChildFragmentManager().findFragmentById(R.id.mapView);
supportMapFragment.getMapAsync(this);
}
So the getMapAsync Task is only called when there is no initialized Map and while there was one he is using it.
from android-samples.
there is no answers or updates or any workaround to this issue ?
from android-samples.
it is old, I guess the only way is that you save the state of the map before any change then reload it again from the stack
cheers
from android-samples.
didn't get your ans. please elaborate little bit more @AryaRDI .
thanks !
from android-samples.
This issue has been automatically marked as stale because it has not had recent activity. Please comment here if it is still valid so that we can reprioritize. Thank you!
from android-samples.
i have same trouble
from android-samples.
In the future, for help with specific situations you'll get the fastest response on StackOverflow (tag google-maps-android-api-2).
For this question, you may want to check out the demos for RetainMap and SaveState.
from android-samples.
You could try to "Add" fragments instead of replacing them.
It will not destroy the previous fragment view, so it won't be necessary to reload the data.
Example:
val fragment = TheFragment()
val ft = requireActivity().supportFragmentManager.beginTransaction()
ft.add(R.id.fragment_container, fragment)
ft.commit()
from android-samples.
Related Issues (20)
- 3D mapping aided corrections HOT 1
- Only part of North and South Pole displayed based on zoom level HOT 2
- Google Maps For Android SDK could not display MapView on AAOS Emulator HOT 3
- How do you smooth MyLocation updates while receiving location requests through "setMyLocationEnabled" ? HOT 4
- Current Place Details on Map tutorial has outdated permissions handling HOT 1
- How to get requestLocationUpdates per second while device by walking? HOT 1
- Polyline add dynamically line color based on location not working. HOT 3
- snippet-bot full scan
- Marker's click event returns wrong marker. HOT 1
- Update targetSdk = compileSdk = 34 for Maps and Places HOT 1
- Remove renderer check from the app HOT 1
- Modernize our Android samples
- Adding a Styled Map sample for Kotlin HOT 1
- Provide example showcasing functionality of Advanced Markers HOT 1
- Move maps-rx snippets to app-rx snippets app
- if defline key in local.properties,the key will error HOT 2
- Crash in camera demo activity HOT 1
- Memory leak in LiteListDemoActivity HOT 1
- Maps HOT 2
- A question for the Demo HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from android-samples.