Is it possible to implement the onLongClickListener method on the map?

Asked

Viewed 67 times

3

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

I’ve already defined the method onClickListener() to open a WindowManager in order to display the name of the point of interest and the address of that place.

Now I want you to, by continuously clicking on one Marker, display a WindowManager different for the user to save this location as a favorite in a table SQLite.

Thanks for all your help...

1 answer

0

I advise to follow this path so I can work upon the possibilities:

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

2 - Now below will be situations in which you will need an update at that specific point you registered in the database and according to each event you perform 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 must be wondering why nay get a possibiludade to onLongClickListener in a Marker? Well... You don’t need to wait for your customer to click on the marker for a second time in order to save information to the bank, since your application has the purpose of salavr locations and also it will prefer to move a marker around the map, than clicking on each point of the map after misses a position or wants to update that particular position.

Source

  • I get the idea. It’s just that I’m not manually adding the markers. I’m calling them through an Arrayadapter<String> to display the types of locations on a spinner and show only the type of place the user selected using the Googleplaces API. Taking this into account how do I store latitude and longitude in Sqlite?

  • Very simple... I already update.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.