1

I would like to add a button to the map pin's snippet to launch an external intent for driving direction to the pin.

I am thinking I can implement something that listens to long click the snippet box, brings up a pop-up to see if user would like to see driving direction and then launches the external activity.

Not sure there is an easy way to do it or the best UX design. Open up to suggestions!

This is my current setup map function:

private void maybeSetUpMapPin() {
  mMap.setMyLocationEnabled(true);
  CameraUpdate cameraUpdate;

  for (Location location : mLocations) {
    MarkerOptions markerOptions = new MarkerOptions()
      .position(new LatLng(location.getLatitude(), location.getLongitude()))
      .title(location.getName())
      .snippet(location.getDescription());
    Marker marker = mMap.addMarker(markerOptions);
  }
  CameraUpdate cameraUpdate = CameraUpdateFactory
      .newLatLngZoom(new LatLng(DEFAULT_LATITUDE, DEFAULT_LONGITUDE), 10.0f);
  mMap.moveCamera(cameraUpdate);
}
Joanne Chow
  • 1,018
  • 10
  • 8
  • Check out http://stackoverflow.com/questions/14123243/google-maps-api-v2-custom-infowindow-like-in-original-android-google-maps?lq=1 http://stackoverflow.com/questions/13810002/adding-buttons-to-map-infowindow-android – Erzer May 21 '14 at 05:30
  • @Erzer Thanks for the suggestion :) Seems like a great idea. – Joanne Chow May 21 '14 at 06:18

1 Answers1

2

You can do it this by using Custom Marker Window implementation in Google Map V2 API.

An info window allows you to display information to the user when they tap on a marker. Only one info window is displayed at a time. If a user clicks on another marker, the current info window will be hidden and the new info window will be displayed.

An info window is drawn oriented against the device's screen, centered above its associated marker. The default info window contains the title in bold, with the (optional) snippet text below the title

Here i saw some link given below

What i achieved by using this?

enter image description here

and another is

enter image description here

hope this help you.

Community
  • 1
  • 1
M D
  • 47,665
  • 9
  • 93
  • 114