Question

Hi I have created some simple code where when I click on the map a marker is added but the problem is that if I rerun the application the markers that I added they disappear.Is there any possible way to somehow make them visible even if I rerun the application ? Thanks. Code for markers onmapclick:

    gMap.setOnMapClickListener(new GoogleMap.OnMapClickListener(){

        @Override
        public void onMapClick(LatLng point) {
            gMap.addMarker(new MarkerOptions().position(point));

        }

    });
Was it helpful?

Solution

when user click on the map... get the latitude and longitude of the location and save the values in a database table. whenever map load, you should select marker locations and add them to the map

OTHER TIPS

Like Dehan Wijesekara said, you can save values in a database but if you want keep it simpler you can use shared preferences.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top