0

I am new to android; I want to add multiple markers on my map by touching it and whenever I touched the marked place again, the marker disappears. My main intention is that lat/lang sent to a server by adding a marker and lat/lang deleted from database in server when I touch the mark for second time.

May you please guide me to add all these functions? how I should start and what I should do?

Thank you so much

altumelix
  • 1
  • 2

1 Answers1

0

You can follow this documentation on how to add markers. Here's a related SO post which might help.

map.setOnMapClickListener(new GoogleMap.OnMapClickListener() {

        @Override
        public void onMapClick(LatLng point) {
            // TODO Auto-generated method stub
            lstLatLngs.add(point);
            map.clear();
            map.addMarker(new MarkerOptions().position(point));
        }
    });

You can also check on this thread on how to add marker in Google maps using data in database. Hope this helps!

Community
  • 1
  • 1
abielita
  • 13,147
  • 2
  • 17
  • 59
  • Maybe my question seems silly but excuse me ecause I am a newbie: Where exactly I should add this code? to "protected void onCreate(Bundle savedInstanceState) {" or to "public void onMapReady(GoogleMap googleMap) {" this part? – altumelix Oct 22 '16 at 12:57