I am doing a little project on Android with Google maps. And I have one question - it is possible to make marker draggable with single click on it, not after long press. For example: I click marker, it changes icon and I can drag it anywhere in map, and then after another tap he will not be draggable again and changes its icon back? (Marker must be draggable all the time from first tap to second even if you release it)
#user2595870:
Hello,
I know it should be in comment but due to less reputations i am suggesting you in answer.
You want to drag and drop facility for marker kind of thing ?
if so there is good example provided here. Please check it.
Related
If i make a tap on the map on a marker, an event gets triggered and i can catch it implementing the interface `OnMarkerClickListener. The event return me the marker on which i tapped; this is straightforward. The problem i'm facing now is that when there are 2 or more marker one on top of another, i don't know on which marker will be triggered the event. I already excluded the possibility that the first marker to be drew is the first to be selected and it seems like the choice is made at randoms, but i think this is not the case.
I would like to know how the API choose on which marker to trigger the event, between the "n" overlapping marker, and how i can control this choice.
I must say that due to some logic in my app i would like to not use Spinderfier or Marker clustering to avoid Marker overlapping; i also found this workaround to eliminate the problem i can't use it.
Sorry for my poor English and thank you for your attention.
How do I disable a new pin being dropped when a user touches the map? This seems like this should be obvious, but I can't find it anywhere! Basically map comes up with my custom pins, user touches anywhere on the screen, a dummy pin appears and mine disappear.
You might want to change the draggable(boolean) function in markerOptions, you can set the draggable to be false.
For more information about a draggable market, you can visit this documentation.
I'm dumb. I got a little copy and paste happy and had that as part of a listener.
I'm using Polaris map library in my android app.
https://github.com/cyrilmottier/Polaris
I've Google Map with some geo points. I'm reading them from database. I've added two buttons on the map activity - "next" and "previous" to navigate between points.
mc.animateTo(geopoints.get(arrayID));
"arrayID" is the id of the next geo point and "mc" is map controller.
It works great but I want to add one more feature.
I want annotation to be visible by default while moving between points. After click on the "next" button I want to be moved to the next point on my map and it's annotation should be visible (not only after clicking on it).
Probably there is an easy way to do it.
I should probably do something with calloutView but I can't figure it out how to do that.
I made something like this. But it's not working properly.
MapCalloutView calloutView;
calloutView = new MapCalloutView(getApplicationContext());
calloutView.setDisclosureEnabled(true);
calloutView.setClickable(true); calloutView.setLeftAccessoryView(getLayoutInflater().inflate(R.layout.accessory, calloutView, false));
calloutView.show(mMapView, geopoints.get(arrayID), false);
calloutView.setData(annotations.get(arrayID));
It is showing me bubble but it creates new calloutView which is wrong I think. For example Polaris listeners are not working. I can't deselect callout etc...
My mistake! It was so easy...
I don't need to play with MapcalloutView in Polaris.
mMapView.setSelectedAnnotation(arrayID);
Recently I show the ubicabs taxi booking app. I found very nice functionality inside it. In this app they have google maps for showing markers, but they have used very good UI component for that. Also I found one more uniqueness is that whenever user moves or change the position of marker through touch it will fetch the current location. One thing that I know is that it is using the onTouchEvent of Overlay but how to create that marker balloon and how to get updated location on the basis of that marker.
I am attaching a preview of that marker here. Also would like to know that how can we scroll the text inside that balloon?
The best overlay open project I have found so far is this one, link. But it is nothing compared to the picture above. Would also like to know how they created this! Great Question and picture ;)
I'm new to Android development and have some question regarding overlays in googlemaps API.
What I'm trying to achieve is a class that adds one and only one marker at the position where you tap, I want this overlay to be active only when a button "add marker" is pressed. I've solved this problem in two different ways and I'm not completely satisfied with either one of them.
My solutions is as follows:
first attempt:
A bool that turns true when "add button" is pressed, then you are able to put a marker on the map and the boolean value turns false.
This feels quite ugly and the overlay is always active and listens to every tap on the display, maybe this is't that dumb as I believe.
second attempt:
Temporary creates the overlay that creates the marker and then immediately removes it self.
This solution I just can't find efficient... Creating new overlay before creating a new marker.
Is there any way to just activate the overlay when "add button" is pressed? Maybe there is some other way to do this?
Is there any way to just activate the overlay when "add button" is pressed?
Don't add it to the overlays list until the add button is pressed.