Question

I want to add a Pinpoint on touched location using google maps v2. I just find code using google maps v1 and that doesnt works for me..

Was it helpful?

Solution

public class YourActivity extends FragmentActivity implements OnMapClickListener {
   private GoogleMap mMap;
  @Override
  protected void onCreate(Bundle saveInstanceState) { 
    super.onCreate(saveInstanceState);
    ...
    my_map.setOnMapClickListener(this)        
    ...
}

public void onMapClick (LatLng point) {
    // Do Something
   mMap = ((MapFragment) getFragmentManager().findFragmentById(R.id.map)).getMap();
   mMap.addMarker(new MarkerOptions()
    .position(point)
    .title("TouchPoint"));
 }
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top