android – Is it possible to implement the onLongClickListener method on the marker in the map?

Question:

I'm developing an application that works on Google Maps API v2.

I've already defined the onClickListener() method to open a WindowManager to display the name of the point of interest and the address of that location.

Now I want that by continuously clicking on a Marker , it displays a different WindowManager so the user can bookmark that location in a SQLite table.

Thank you in advance for all your help…

Answer:

I advise following this path in order to work on the possibilities:

1 – When creating a marker**(addMarker)**, immediately save the latitude and longitude information in the database.

2 – Now, below will be situations in which an update will be necessary at that specific point you registered in the bank and according to each event you carry out the updates:

mapa.setOnMarkerDragListener(new OnMarkerDragListener() {

        @Override
        public void onMarkerDragStart(Marker marker) {
            // Primeiro contato

        }

        @Override
        public void onMarkerDragEnd(Marker marker) {
            // Fim contato

        }

        @Override
        public void onMarkerDrag(Marker marker) {
            // Contato contínuo

        }
    });

Now you might be wondering why not look for a chance for onLongClickListener in a marker ? Well… You don't need to wait for your client to click on the marker a second time to save information in the bank, since your application has the objective of saving locations and it will also prefer to move a marker around the map, than keep clicking on each point on the map after making a mistake or wanting to update that particular position.

Source

Scroll to Top