Google Maps v2 zoom to specific marker - android

I have a search AutoComplete in my map and display the title from my database. Can it be possible to put zoom functionality to that specific marker? I'm using google maps api v2.

Look at these code snippets:
https://developers.google.com/maps/documentation/android/
This should be what you're looking for:
GoogleMap map = ((MapFragment) getFragmentManager()
.findFragmentById(R.id.map)).getMap();
LatLng sydney = new LatLng(-33.867, 151.206);
map.setMyLocationEnabled(true);
map.moveCamera(CameraUpdateFactory.newLatLngZoom(sydney, 13));

Related

Google Maps Android API v2: how can i set marker over "blue dot" (z order)

I am writing an app using Google Maps Android v2 SDK. When I place a marker on the map at my location, it always appears underneath the default "blue dot" from the built-in my location layer. This does not happen when using the Google Maps SDK for iOS. How can I make my own marker be drawn on top of the blue dot?
You can add marker on your location like this :
LatLng latLng = new LatLng(mCurrentLocation.getLatitude(),
mCurrentLocation.getLongitude());
MarkerOptions markerOptions = new MarkerOptions();
markerOptions.position(latLng);
markerOptions.title("You");
mCurrLocationMarker = mGoogleMap.addMarker(markerOptions);
mCurrLocationMarker.setVisible(true);
Please search google or stackoverflow first always..Hope it helps
markers have a zIndex() value which you can use

Move the marker along the with map as the user moves

I have implemented google map into my app. I have added a custom marker at my current location.I want to move the marker as the user moves, along with the map. I want to implement the functionality as in google maps navigation. While googling i found the following links but did not get the result. so can any one help me out ?
I have added this in onLocationChanged()
LatLng latLng = new LatLng(location.getLatitude(), location.getLongitude());
sourceLocation = latLng;
startPoint = new GeoPoint(latLng.latitude,latLng.longitude);
forNavigation = location;
// animation
mMap.moveCamera(CameraUpdateFactory.newLatLng(latLng));
// Zoom in the Google Map
mMap.animateCamera(CameraUpdateFactory.zoomTo(15));
// mMap.animateCamera(CameraUpdateFactory.newLatLngZoom(mPositionMarker.getPosition(), 15));
mMap.animateCamera(CameraUpdateFactory.newLatLng(new LatLng(location
.getLatitude(), location.getLongitude())));
These are the links which i found
Google map: moving marker and map together smoothly along with user?
How to smoothly keep moving current location marker in Google Maps v2 android
here is two solution you have.
Use onlocationtrue then it show you blue dot as your current location.
Use fused api for current location and create you marker in locationchanged.
for fused api you can check from here.
thanks

How to add image to marker google maps api v2?

I want to send image by marker to infoWindow().
Smaple:
addMarker(new MarkerOptions()
.position(latlng)
.title("HI")
.snippet("HI;HI")
.icon(BitmapDescriptorFactory.fromResource(R.drawable.same))
.image(SampleForImage)); **// Sample what I want**
is that possible?

Google Maps Android API v2 Show marker on zoom level

How can show markers on specific zoom level using Google Maps Android API v2? I have more than 1000 Markers, so it's not good idea to show all on start.
Here is simple example:
#
// latitude and longitude
double latitude = 40.738933;
double longitude = -74.001366;
// create marker
MarkerOptions marker = new MarkerOptions().position(new LatLng(latitude, longitude)).title("Hello Maps ");
// adding marker
googleMap.addMarker(marker);
#
Thank you for help
put below code
googleMap.moveCamera(CameraUpdateFactory.newLatLngZoom(HAMBURG, 15));
here Move the camera instantly to marker with a zoom of 15. if you wanna change zoom level you can change.

Plotting on maps in android

I am making an application where I get an message with latitude and longitude, I search that and then plot it on google maps.
How to accomplish the plotting ??
If by "plotting on the map" you mean adding a marker (icon) to a map at a given Latitude / Longitude, you can use the following code to put a Marker on Sydney on the map :
private GoogleMap mMap;
mMap = ((MapFragment) getFragmentManager().findFragmentById(R.id.map)).getMap();
mMap.addMarker(new MarkerOptions()
.position(new LatLng(-33.88,151.21))
.title("Hello world"));
The LatLng object accepts 2 doubles representing a latitude and a longitude in degrees.
The Google Maps Android API v2 is pretty well-documented. There's also a guide on Markers in Google Maps Android API v2

Categories

Resources