Reputation: 41
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..
Upvotes: 1
Views: 1376
Reputation: 877
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"));
}
}
Upvotes: 7