I would like to ask about how can I add different overlays to my android application?
as I already have one overlay class that extends Overlay and it draws polylines according to some points in a KML file.
and now I would like to create another overlay that adds a pin in the user's location using GPS, so I don't know how this could be done.
please anyone knows how to help me ?
thank you in advance.
You can have multiple overlays on top of one map.
Just create the second layer as an ItemizedOverlay, and add it to the map:
myMapView.getOverlays().add(myItemizedOverlay);
To learn how to add markers to an ItemizedOverlay, see http://android-coding.blogspot.com/2011/06/using-itemizedoverlay-to-add-marker-on.html.
To add a pin to the user's location use MyLocationOverlay it's in the google maps API see this link
Android GoogleMaps API Documentation may also help.
Related
I want to make a custom notification with big style but i don't know how to insert google map with path and multiple marker like below image please help.
You will want to use the google static maps API.
https://developers.google.com/maps/documentation/static-maps/intro#Markers
The link above will direct you to the markers sections. There you can read about how to use custom markers.
By using the above API you will eventually get a map bitmap, that can easily be used inside the notification.
I want a custom InfoWindowAdapter to be shown on the Marker.
I have already made a custom InfoWindowAdapter and implemented it but the problem is that by default it is shown above the Marker and I want it to be shown on the left side.
I went through some previous related question but didn't get a best answer.
Here is an image of what i want.
Thanks.
Starting from September update (v12 or 3.2.65) of the Google Maps Android API v2 MarkerOptions.infoWindowAnchor was added. There are quite a few new functions, so check release notes too.
Edit:
Unfortunatelly this addition doesn't solve your problem yet. Added new issue for that.
You can use the infoWindowAnchor() when you add marker as shown;
marker = mMap.addMarker(new MarkerOptions().position(markerPosition).icon(bitmapDescriptorFromVector(MapActivity.this, R.drawable.user_marker)).title(title).infoWindowAnchor(3.1f,1.0f));
I am creating an Android application which uses GPS to show an user their current location.
I have this part of the application working and the location shows up on map view but I was wondering how do I go about adding a marker on the location? I understand it has something to do with creating an Overlay but am unsure how to go about doing this.
Also I wish for assistance in adding a zoom in/out control button.
Many thanks.
Check the following Link
http://blog.pocketjourney.com/2008/03/19/tutorial-2-mapview-google-map-hit-testing-for-display-of-popup-windows/
not only you can draw anything on the map you can animate the view as well. using this i implmented drop pin effect as that of IPhone in Android
Using Canvas and onDraw Method is tough but the best and core way to handle things.
Hope it helps :)
You can use this project to achieve that you want:
mapviewballoons
Hope this helps.
I have the map working on android and am able to populate it with overlays.
But the overlay ability is only so good. If I add too many overlays and refresh too often, I can create an app that is very processor-hard (useless).
What I want to do is only load the overlays that are within the zoom level of the map.
How to I get at what level the map is zoomed using Google APIS, overlays, itemized, and geopoints?
Thanks,
You can use the getZoomLevel and getMapCenter methods on MapView. You might also read through the MapView class documentation.
You can directly get that from class without any method.
map.getCameraPosition().zoom
I've got a place I want to add on my map at a particular lat / lng. I'd like to display that on my map when the activity starts. How would I do this?
Thanks.
This Google/Android tutorial should provide exactly the information you need.
Basically you create an custom ItemizedOverlay, grab a list of overlays from the MapView (getOverlays), create some GeoPoints and your set.
The Google Maps library documentation is a great reference for map related questions.