How to add image to marker google maps api v2? - android

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?

Related

Using a text file to insert multiple Markers on the Google Maps V2

In my recent post i was asking for the way to insert multiple Markers on the google map via an ArrayList.
Now i want to use a text file to store (position , title , snippet , icon)
Assuming that i use this code to store every marker:
Marker marker1 = map.addMarker(new MarkerOptions()
.position(new LatLng(1.123456, -2.123456))
.title("Title1")
.snippet("Snippet1")
.icon(BitmapDescriptorFactory.fromResource(R.drawable.icon1)));
Marker marker2 = map.addMarker(new MarkerOptions()
.position(new LatLng(3.123456,-4.123456))
.title("Title2")
.snippet("Snippet2")
.icon(BitmapDescriptorFactory.fromResource(R.drawable.icon2)));
...
How to use a text file to store all marker properties and how to use these properties in my map ?

Display my location marker above all others

I am using google maps in my android app, and I wanted to use a custom myLocation marker
I need it to be on top of the other markers, how can make it be on top ?
Try below code, it helped me to show marker above to all other markers
mMap.addMarker(new MarkerOptions()
.position(mLatLng)
.title("" + name)
.snippet("" + pingDate)
.icon(BitmapDescriptorFactory.fromBitmap(icon))
.zIndex(yourZIndex));
Here is screenshot of my application

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

Google Maps API v2 Marker with Street View Image as Icon

I'm using Google Maps Android API v2 and I've got everything set up correctly. I have set some markers based on latitude / longitude.
How can I add the Street View image of the lat/lng as an icon?
/* Google Maps API v2 map set code here */
Marker marker = map.addMarker(new MarkerOptions().position(point)
.title("Title")
.snippet("Snippet")
.icon( StreetViewObject? ));
Thanks
You can use this api to get an image based on your latitude and longitude:
https://developers.google.com/maps/documentation/streetview/

Categories

Resources