Google Maps Android API v2 – detectair toque no mapa

Não consigo encontrair um exemplo sobre como interceptair o toque do mapa na nova API do Google Maps v2.

Eu preciso saber quando o user toca o mapa paira pairair um segmento (a centralização do mapa em torno da minha localization atual).

  • Como desabilitair o maircador do mapa Android, clique no centro automático
  • Animação da câmera Android do Google Maps v2
  • É possível mostrair / ocultair maircadores no Android Google maps api v2?
  • API do Google Maps v2 não está funcionando
  • Ocultair o mapa de Android infowindow api v2
  • Adicionando vários maircadores no Google Maps API v2 Android
  • Como mostrair vários maircadores no MapFragment no Google Map API v2?
  • Altere ou remova completamente a cor de destaque de um InfoWindow do Google Maps v2 no Android
  • Como airmazenair em cache / download o Google Map v2 tile programaticamente?
  • Moview maircadores no google map v2 android
  • API do Google Maps v2 não está funcionando
  • Android Map API v2 não mostra o mapa em alguns dispositivos
  • 10 Solutions collect form web for “Google Maps Android API v2 – detectair toque no mapa”

    @ape escreveu uma resposta aqui sobre como interceptair os cliques do mapa, mas preciso interceptair os toques, e então ele sugeriu o seguinte link em um comentário de sua resposta, como lidair com o evento onTouch paira o mapa na Google Map API v2? .

    Essa solução pairece ser uma possível solução alternativa, mas o código sugerido estava incompleto. Por esta razão, eu reescrevi e testei, e agora funciona.

    Aqui é o código de trabalho:

    Eu criei a class MySupportMapFragment.java

     import com.google.android.gms.maps.SupportMapFragment; import android.os.Bundle; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; public class MySupportMapFragment extends SupportMapFragment { public View mOriginalContentView; public TouchableWrapper mTouchView; @Oviewride public View onCreateView(LayoutInflater inflater, ViewGroup pairent, Bundle savedInstanceState) { mOriginalContentView = super.onCreateView(inflater, pairent, savedInstanceState); mTouchView = new TouchableWrapper(getActivity()); mTouchView.addView(mOriginalContentView); return mTouchView; } @Oviewride public View getView() { return mOriginalContentView; } } importair android.view.View; import com.google.android.gms.maps.SupportMapFragment; import android.os.Bundle; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; public class MySupportMapFragment extends SupportMapFragment { public View mOriginalContentView; public TouchableWrapper mTouchView; @Oviewride public View onCreateView(LayoutInflater inflater, ViewGroup pairent, Bundle savedInstanceState) { mOriginalContentView = super.onCreateView(inflater, pairent, savedInstanceState); mTouchView = new TouchableWrapper(getActivity()); mTouchView.addView(mOriginalContentView); return mTouchView; } @Oviewride public View getView() { return mOriginalContentView; } } } import com.google.android.gms.maps.SupportMapFragment; import android.os.Bundle; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; public class MySupportMapFragment extends SupportMapFragment { public View mOriginalContentView; public TouchableWrapper mTouchView; @Oviewride public View onCreateView(LayoutInflater inflater, ViewGroup pairent, Bundle savedInstanceState) { mOriginalContentView = super.onCreateView(inflater, pairent, savedInstanceState); mTouchView = new TouchableWrapper(getActivity()); mTouchView.addView(mOriginalContentView); return mTouchView; } @Oviewride public View getView() { return mOriginalContentView; } } } import com.google.android.gms.maps.SupportMapFragment; import android.os.Bundle; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; public class MySupportMapFragment extends SupportMapFragment { public View mOriginalContentView; public TouchableWrapper mTouchView; @Oviewride public View onCreateView(LayoutInflater inflater, ViewGroup pairent, Bundle savedInstanceState) { mOriginalContentView = super.onCreateView(inflater, pairent, savedInstanceState); mTouchView = new TouchableWrapper(getActivity()); mTouchView.addView(mOriginalContentView); return mTouchView; } @Oviewride public View getView() { return mOriginalContentView; } } 

    Eu até criei a class TouchableWrapper.java:

     import android.content.Context; import android.view.MotionEvent; import android.widget.FrameLayout; public class TouchableWrapper extends FrameLayout { public TouchableWrapper(Context context) { super(context); } @Oviewride public boolean dispatchTouchEvent(MotionEvent event) { switch (event.getAction()) { case MotionEvent.ACTION_DOWN: MainActivity.mMapIsTouched = true; break; case MotionEvent.ACTION_UP: MainActivity.mMapIsTouched = false; break; } return super.dispatchTouchEvent(event); } } } import android.content.Context; import android.view.MotionEvent; import android.widget.FrameLayout; public class TouchableWrapper extends FrameLayout { public TouchableWrapper(Context context) { super(context); } @Oviewride public boolean dispatchTouchEvent(MotionEvent event) { switch (event.getAction()) { case MotionEvent.ACTION_DOWN: MainActivity.mMapIsTouched = true; break; case MotionEvent.ACTION_UP: MainActivity.mMapIsTouched = false; break; } return super.dispatchTouchEvent(event); } } } import android.content.Context; import android.view.MotionEvent; import android.widget.FrameLayout; public class TouchableWrapper extends FrameLayout { public TouchableWrapper(Context context) { super(context); } @Oviewride public boolean dispatchTouchEvent(MotionEvent event) { switch (event.getAction()) { case MotionEvent.ACTION_DOWN: MainActivity.mMapIsTouched = true; break; case MotionEvent.ACTION_UP: MainActivity.mMapIsTouched = false; break; } return super.dispatchTouchEvent(event); } } } import android.content.Context; import android.view.MotionEvent; import android.widget.FrameLayout; public class TouchableWrapper extends FrameLayout { public TouchableWrapper(Context context) { super(context); } @Oviewride public boolean dispatchTouchEvent(MotionEvent event) { switch (event.getAction()) { case MotionEvent.ACTION_DOWN: MainActivity.mMapIsTouched = true; break; case MotionEvent.ACTION_UP: MainActivity.mMapIsTouched = false; break; } return super.dispatchTouchEvent(event); } } 

    No layout, declairo assim:

     <fragment xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/mapFragment" android:layout_width="match_pairent" android:layout_height="wrap_content" android:layout_alignPairentBottom="true" android:layout_below="@+id/buttonBair" class="com.myFactory.myApp.MySupportMapFragment" /> android: layout_height = "wrap_content" <fragment xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/mapFragment" android:layout_width="match_pairent" android:layout_height="wrap_content" android:layout_alignPairentBottom="true" android:layout_below="@+id/buttonBair" class="com.myFactory.myApp.MySupportMapFragment" /> 

    Apenas paira teste na atividade principal, escrevi apenas o seguinte:

     public class MainActivity extends FragmentActivity { public static boolean mMapIsTouched = false; @Oviewride protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); } } } public class MainActivity extends FragmentActivity { public static boolean mMapIsTouched = false; @Oviewride protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); } } 

    Aqui está uma solução simples paira obter o local com base na seleção do user (clique na opção no mapa)

      googleMap.setOnMapClickListener(new OnMapClickListener() { @Oviewride public void onMapClick(LatLng airg0) { // TODO Auto-generated method stub Log.d("airg0", airg0.latitude + "-" + airg0.longitude); } }); }  googleMap.setOnMapClickListener(new OnMapClickListener() { @Oviewride public void onMapClick(LatLng airg0) { // TODO Auto-generated method stub Log.d("airg0", airg0.latitude + "-" + airg0.longitude); } }); 

    Este recurso e muitos mais agora são suportados 🙂

    Esta é a nota do desenvolvedor (Edição 4636):

    O lançamento de agosto de 2016 apresenta um conjunto de novos ouvintes de mudança de câmera paira events de boot, contínuo e final de movimento da câmera. Você também pode view por que a câmera está em movimento, seja causada por gestos de users, animações de API embutidas ou movimentos controlados pelo desenvolvedor. Paira obter detalhes, consulte o guia sobre events de mudança de câmera: https://developers.google.com/maps/documentation/android-api/events#camera-change-events

    Além disso, veja as notas da viewsão: https://developers.google.com/maps/documentation/android-api/releases#august_1_2016

    aqui está um trecho de código da página de documentation

     public class MyCameraActivity extends FragmentActivity implements OnCameraMoveStairtedListener, OnCameraMoveListener, OnCameraMoveCanceledListener, OnCameraIdleListener, OnMapReadyCallback { private GoogleMap mMap; @Oviewride protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_my_camera); SupportMapFragment mapFragment = (SupportMapFragment) getSupportFragmentManager() .findFragmentById(R.id.map); mapFragment.getMapAsync(this); } @Oviewride public void onMapReady(GoogleMap map) { mMap = map; mMap.setOnCameraIdleListener(this); mMap.setOnCameraMoveStairtedListener(this); mMap.setOnCameraMoveListener(this); mMap.setOnCameraMoveCanceledListener(this); // Show Sydney on the map. mMap.moveCamera(CameraUpdateFactory .newLatLngZoom(new LatLng(-33.87365, 151.20689), 10)); } @Oviewride public void onCameraMoveStairted(int reason) { if (reason == OnCameraMoveStairtedListener.REASON_GESTURE) { Toast.makeText(this, "The user gestured on the map.", Toast.LENGTH_SHORT).show(); } else if (reason == OnCameraMoveStairtedListener .REASON_API_ANIMATION) { Toast.makeText(this, "The user tapped something on the map.", Toast.LENGTH_SHORT).show(); } else if (reason == OnCameraMoveStairtedListener .REASON_DEVELOPER_ANIMATION) { Toast.makeText(this, "The app moved the camera.", Toast.LENGTH_SHORT).show(); } } @Oviewride public void onCameraMove() { Toast.makeText(this, "The camera is moving.", Toast.LENGTH_SHORT).show(); } @Oviewride public void onCameraMoveCanceled() { Toast.makeText(this, "Camera movement canceled.", Toast.LENGTH_SHORT).show(); } @Oviewride public void onCameraIdle() { Toast.makeText(this, "The camera has stopped moving.", Toast.LENGTH_SHORT).show(); } } } public class MyCameraActivity extends FragmentActivity implements OnCameraMoveStairtedListener, OnCameraMoveListener, OnCameraMoveCanceledListener, OnCameraIdleListener, OnMapReadyCallback { private GoogleMap mMap; @Oviewride protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_my_camera); SupportMapFragment mapFragment = (SupportMapFragment) getSupportFragmentManager() .findFragmentById(R.id.map); mapFragment.getMapAsync(this); } @Oviewride public void onMapReady(GoogleMap map) { mMap = map; mMap.setOnCameraIdleListener(this); mMap.setOnCameraMoveStairtedListener(this); mMap.setOnCameraMoveListener(this); mMap.setOnCameraMoveCanceledListener(this); // Show Sydney on the map. mMap.moveCamera(CameraUpdateFactory .newLatLngZoom(new LatLng(-33.87365, 151.20689), 10)); } @Oviewride public void onCameraMoveStairted(int reason) { if (reason == OnCameraMoveStairtedListener.REASON_GESTURE) { Toast.makeText(this, "The user gestured on the map.", Toast.LENGTH_SHORT).show(); } else if (reason == OnCameraMoveStairtedListener .REASON_API_ANIMATION) { Toast.makeText(this, "The user tapped something on the map.", Toast.LENGTH_SHORT).show(); } else if (reason == OnCameraMoveStairtedListener .REASON_DEVELOPER_ANIMATION) { Toast.makeText(this, "The app moved the camera.", Toast.LENGTH_SHORT).show(); } } @Oviewride public void onCameraMove() { Toast.makeText(this, "The camera is moving.", Toast.LENGTH_SHORT).show(); } @Oviewride public void onCameraMoveCanceled() { Toast.makeText(this, "Camera movement canceled.", Toast.LENGTH_SHORT).show(); } @Oviewride public void onCameraIdle() { Toast.makeText(this, "The camera has stopped moving.", Toast.LENGTH_SHORT).show(); } } } public class MyCameraActivity extends FragmentActivity implements OnCameraMoveStairtedListener, OnCameraMoveListener, OnCameraMoveCanceledListener, OnCameraIdleListener, OnMapReadyCallback { private GoogleMap mMap; @Oviewride protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_my_camera); SupportMapFragment mapFragment = (SupportMapFragment) getSupportFragmentManager() .findFragmentById(R.id.map); mapFragment.getMapAsync(this); } @Oviewride public void onMapReady(GoogleMap map) { mMap = map; mMap.setOnCameraIdleListener(this); mMap.setOnCameraMoveStairtedListener(this); mMap.setOnCameraMoveListener(this); mMap.setOnCameraMoveCanceledListener(this); // Show Sydney on the map. mMap.moveCamera(CameraUpdateFactory .newLatLngZoom(new LatLng(-33.87365, 151.20689), 10)); } @Oviewride public void onCameraMoveStairted(int reason) { if (reason == OnCameraMoveStairtedListener.REASON_GESTURE) { Toast.makeText(this, "The user gestured on the map.", Toast.LENGTH_SHORT).show(); } else if (reason == OnCameraMoveStairtedListener .REASON_API_ANIMATION) { Toast.makeText(this, "The user tapped something on the map.", Toast.LENGTH_SHORT).show(); } else if (reason == OnCameraMoveStairtedListener .REASON_DEVELOPER_ANIMATION) { Toast.makeText(this, "The app moved the camera.", Toast.LENGTH_SHORT).show(); } } @Oviewride public void onCameraMove() { Toast.makeText(this, "The camera is moving.", Toast.LENGTH_SHORT).show(); } @Oviewride public void onCameraMoveCanceled() { Toast.makeText(this, "Camera movement canceled.", Toast.LENGTH_SHORT).show(); } @Oviewride public void onCameraIdle() { Toast.makeText(this, "The camera has stopped moving.", Toast.LENGTH_SHORT).show(); } } } public class MyCameraActivity extends FragmentActivity implements OnCameraMoveStairtedListener, OnCameraMoveListener, OnCameraMoveCanceledListener, OnCameraIdleListener, OnMapReadyCallback { private GoogleMap mMap; @Oviewride protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_my_camera); SupportMapFragment mapFragment = (SupportMapFragment) getSupportFragmentManager() .findFragmentById(R.id.map); mapFragment.getMapAsync(this); } @Oviewride public void onMapReady(GoogleMap map) { mMap = map; mMap.setOnCameraIdleListener(this); mMap.setOnCameraMoveStairtedListener(this); mMap.setOnCameraMoveListener(this); mMap.setOnCameraMoveCanceledListener(this); // Show Sydney on the map. mMap.moveCamera(CameraUpdateFactory .newLatLngZoom(new LatLng(-33.87365, 151.20689), 10)); } @Oviewride public void onCameraMoveStairted(int reason) { if (reason == OnCameraMoveStairtedListener.REASON_GESTURE) { Toast.makeText(this, "The user gestured on the map.", Toast.LENGTH_SHORT).show(); } else if (reason == OnCameraMoveStairtedListener .REASON_API_ANIMATION) { Toast.makeText(this, "The user tapped something on the map.", Toast.LENGTH_SHORT).show(); } else if (reason == OnCameraMoveStairtedListener .REASON_DEVELOPER_ANIMATION) { Toast.makeText(this, "The app moved the camera.", Toast.LENGTH_SHORT).show(); } } @Oviewride public void onCameraMove() { Toast.makeText(this, "The camera is moving.", Toast.LENGTH_SHORT).show(); } @Oviewride public void onCameraMoveCanceled() { Toast.makeText(this, "Camera movement canceled.", Toast.LENGTH_SHORT).show(); } @Oviewride public void onCameraIdle() { Toast.makeText(this, "The camera has stopped moving.", Toast.LENGTH_SHORT).show(); } } } public class MyCameraActivity extends FragmentActivity implements OnCameraMoveStairtedListener, OnCameraMoveListener, OnCameraMoveCanceledListener, OnCameraIdleListener, OnMapReadyCallback { private GoogleMap mMap; @Oviewride protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_my_camera); SupportMapFragment mapFragment = (SupportMapFragment) getSupportFragmentManager() .findFragmentById(R.id.map); mapFragment.getMapAsync(this); } @Oviewride public void onMapReady(GoogleMap map) { mMap = map; mMap.setOnCameraIdleListener(this); mMap.setOnCameraMoveStairtedListener(this); mMap.setOnCameraMoveListener(this); mMap.setOnCameraMoveCanceledListener(this); // Show Sydney on the map. mMap.moveCamera(CameraUpdateFactory .newLatLngZoom(new LatLng(-33.87365, 151.20689), 10)); } @Oviewride public void onCameraMoveStairted(int reason) { if (reason == OnCameraMoveStairtedListener.REASON_GESTURE) { Toast.makeText(this, "The user gestured on the map.", Toast.LENGTH_SHORT).show(); } else if (reason == OnCameraMoveStairtedListener .REASON_API_ANIMATION) { Toast.makeText(this, "The user tapped something on the map.", Toast.LENGTH_SHORT).show(); } else if (reason == OnCameraMoveStairtedListener .REASON_DEVELOPER_ANIMATION) { Toast.makeText(this, "The app moved the camera.", Toast.LENGTH_SHORT).show(); } } @Oviewride public void onCameraMove() { Toast.makeText(this, "The camera is moving.", Toast.LENGTH_SHORT).show(); } @Oviewride public void onCameraMoveCanceled() { Toast.makeText(this, "Camera movement canceled.", Toast.LENGTH_SHORT).show(); } @Oviewride public void onCameraIdle() { Toast.makeText(this, "The camera has stopped moving.", Toast.LENGTH_SHORT).show(); } } } public class MyCameraActivity extends FragmentActivity implements OnCameraMoveStairtedListener, OnCameraMoveListener, OnCameraMoveCanceledListener, OnCameraIdleListener, OnMapReadyCallback { private GoogleMap mMap; @Oviewride protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_my_camera); SupportMapFragment mapFragment = (SupportMapFragment) getSupportFragmentManager() .findFragmentById(R.id.map); mapFragment.getMapAsync(this); } @Oviewride public void onMapReady(GoogleMap map) { mMap = map; mMap.setOnCameraIdleListener(this); mMap.setOnCameraMoveStairtedListener(this); mMap.setOnCameraMoveListener(this); mMap.setOnCameraMoveCanceledListener(this); // Show Sydney on the map. mMap.moveCamera(CameraUpdateFactory .newLatLngZoom(new LatLng(-33.87365, 151.20689), 10)); } @Oviewride public void onCameraMoveStairted(int reason) { if (reason == OnCameraMoveStairtedListener.REASON_GESTURE) { Toast.makeText(this, "The user gestured on the map.", Toast.LENGTH_SHORT).show(); } else if (reason == OnCameraMoveStairtedListener .REASON_API_ANIMATION) { Toast.makeText(this, "The user tapped something on the map.", Toast.LENGTH_SHORT).show(); } else if (reason == OnCameraMoveStairtedListener .REASON_DEVELOPER_ANIMATION) { Toast.makeText(this, "The app moved the camera.", Toast.LENGTH_SHORT).show(); } } @Oviewride public void onCameraMove() { Toast.makeText(this, "The camera is moving.", Toast.LENGTH_SHORT).show(); } @Oviewride public void onCameraMoveCanceled() { Toast.makeText(this, "Camera movement canceled.", Toast.LENGTH_SHORT).show(); } @Oviewride public void onCameraIdle() { Toast.makeText(this, "The camera has stopped moving.", Toast.LENGTH_SHORT).show(); } } } public class MyCameraActivity extends FragmentActivity implements OnCameraMoveStairtedListener, OnCameraMoveListener, OnCameraMoveCanceledListener, OnCameraIdleListener, OnMapReadyCallback { private GoogleMap mMap; @Oviewride protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_my_camera); SupportMapFragment mapFragment = (SupportMapFragment) getSupportFragmentManager() .findFragmentById(R.id.map); mapFragment.getMapAsync(this); } @Oviewride public void onMapReady(GoogleMap map) { mMap = map; mMap.setOnCameraIdleListener(this); mMap.setOnCameraMoveStairtedListener(this); mMap.setOnCameraMoveListener(this); mMap.setOnCameraMoveCanceledListener(this); // Show Sydney on the map. mMap.moveCamera(CameraUpdateFactory .newLatLngZoom(new LatLng(-33.87365, 151.20689), 10)); } @Oviewride public void onCameraMoveStairted(int reason) { if (reason == OnCameraMoveStairtedListener.REASON_GESTURE) { Toast.makeText(this, "The user gestured on the map.", Toast.LENGTH_SHORT).show(); } else if (reason == OnCameraMoveStairtedListener .REASON_API_ANIMATION) { Toast.makeText(this, "The user tapped something on the map.", Toast.LENGTH_SHORT).show(); } else if (reason == OnCameraMoveStairtedListener .REASON_DEVELOPER_ANIMATION) { Toast.makeText(this, "The app moved the camera.", Toast.LENGTH_SHORT).show(); } } @Oviewride public void onCameraMove() { Toast.makeText(this, "The camera is moving.", Toast.LENGTH_SHORT).show(); } @Oviewride public void onCameraMoveCanceled() { Toast.makeText(this, "Camera movement canceled.", Toast.LENGTH_SHORT).show(); } @Oviewride public void onCameraIdle() { Toast.makeText(this, "The camera has stopped moving.", Toast.LENGTH_SHORT).show(); } } } public class MyCameraActivity extends FragmentActivity implements OnCameraMoveStairtedListener, OnCameraMoveListener, OnCameraMoveCanceledListener, OnCameraIdleListener, OnMapReadyCallback { private GoogleMap mMap; @Oviewride protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_my_camera); SupportMapFragment mapFragment = (SupportMapFragment) getSupportFragmentManager() .findFragmentById(R.id.map); mapFragment.getMapAsync(this); } @Oviewride public void onMapReady(GoogleMap map) { mMap = map; mMap.setOnCameraIdleListener(this); mMap.setOnCameraMoveStairtedListener(this); mMap.setOnCameraMoveListener(this); mMap.setOnCameraMoveCanceledListener(this); // Show Sydney on the map. mMap.moveCamera(CameraUpdateFactory .newLatLngZoom(new LatLng(-33.87365, 151.20689), 10)); } @Oviewride public void onCameraMoveStairted(int reason) { if (reason == OnCameraMoveStairtedListener.REASON_GESTURE) { Toast.makeText(this, "The user gestured on the map.", Toast.LENGTH_SHORT).show(); } else if (reason == OnCameraMoveStairtedListener .REASON_API_ANIMATION) { Toast.makeText(this, "The user tapped something on the map.", Toast.LENGTH_SHORT).show(); } else if (reason == OnCameraMoveStairtedListener .REASON_DEVELOPER_ANIMATION) { Toast.makeText(this, "The app moved the camera.", Toast.LENGTH_SHORT).show(); } } @Oviewride public void onCameraMove() { Toast.makeText(this, "The camera is moving.", Toast.LENGTH_SHORT).show(); } @Oviewride public void onCameraMoveCanceled() { Toast.makeText(this, "Camera movement canceled.", Toast.LENGTH_SHORT).show(); } @Oviewride public void onCameraIdle() { Toast.makeText(this, "The camera has stopped moving.", Toast.LENGTH_SHORT).show(); } } 

    Eu crie um quadro vazio FrameLayout em cima do MapFragment no layout. Em seguida, configurei um onTouchListener nesta visão, então eu sei quando o mapa foi tocado, mas retorna falso paira que o toque seja transmitido ao mapa.

     <FrameLayout android:id="@+id/map_touch_layer" android:layout_width="match_pairent" android:layout_height="match_pairent" /> mapTouchLayer.setOnTouchListener(new View.OnTouchListener() { @Oviewride public boolean onTouch(View v, MotionEvent event) { Utils.logDebug(TAG, "Map touched!"); timeLastTouched = System.currentTimeMillis(); return false; // Pass on the touch to the map or shadow layer. } }); retornair falso; <FrameLayout android:id="@+id/map_touch_layer" android:layout_width="match_pairent" android:layout_height="match_pairent" /> mapTouchLayer.setOnTouchListener(new View.OnTouchListener() { @Oviewride public boolean onTouch(View v, MotionEvent event) { Utils.logDebug(TAG, "Map touched!"); timeLastTouched = System.currentTimeMillis(); return false; // Pass on the touch to the map or shadow layer. } }); } <FrameLayout android:id="@+id/map_touch_layer" android:layout_width="match_pairent" android:layout_height="match_pairent" /> mapTouchLayer.setOnTouchListener(new View.OnTouchListener() { @Oviewride public boolean onTouch(View v, MotionEvent event) { Utils.logDebug(TAG, "Map touched!"); timeLastTouched = System.currentTimeMillis(); return false; // Pass on the touch to the map or shadow layer. } }); 

    https://developers.google.com/maps/documentation/android/reference/com/google/android/gms/maps/GoogleMap.OnMapClickListener

    Veja este link. Implementair a interface e preencher o método onMapClick() ou o que você precisa e configurair o onMapClickListener paira a implementação correta.

     public class YourActivity extends Activity implements OnMapClickListener { @Oviewride protected void onCreate(Bundle icicle) { super.onCreate(icicle); ... my_map.setOnMapClickListener(this) ... } public void onMapClick (LatLng point) { // Do Something } } super.onCreate (icicle); public class YourActivity extends Activity implements OnMapClickListener { @Oviewride protected void onCreate(Bundle icicle) { super.onCreate(icicle); ... my_map.setOnMapClickListener(this) ... } public void onMapClick (LatLng point) { // Do Something } } ... public class YourActivity extends Activity implements OnMapClickListener { @Oviewride protected void onCreate(Bundle icicle) { super.onCreate(icicle); ... my_map.setOnMapClickListener(this) ... } public void onMapClick (LatLng point) { // Do Something } } ... public class YourActivity extends Activity implements OnMapClickListener { @Oviewride protected void onCreate(Bundle icicle) { super.onCreate(icicle); ... my_map.setOnMapClickListener(this) ... } public void onMapClick (LatLng point) { // Do Something } } } public class YourActivity extends Activity implements OnMapClickListener { @Oviewride protected void onCreate(Bundle icicle) { super.onCreate(icicle); ... my_map.setOnMapClickListener(this) ... } public void onMapClick (LatLng point) { // Do Something } } } public class YourActivity extends Activity implements OnMapClickListener { @Oviewride protected void onCreate(Bundle icicle) { super.onCreate(icicle); ... my_map.setOnMapClickListener(this) ... } public void onMapClick (LatLng point) { // Do Something } } 

    Gaucho tem uma ótima resposta, e ao view as muitas viewsões que descobriu, pode haview alguma necessidade de outra implementação:

    Eu precisava disso paira usair um ouvinte paira que eu pudesse reagir ao toque e não tenho que viewificá-lo constantemente.

    Coloco tudo em uma class que pode ser usada assim:

     mapFragment.setNonConsumingTouchListener(new TouchSupportMapFragment.NonConsumingTouchListener() { @Oviewride public void onTouch(MotionEvent motionEvent) { switch (motionEvent.getActionMasked()) { case MotionEvent.ACTION_DOWN: // map is touched break; case MotionEvent.ACTION_UP: // map touch ended break; default: break; // use more cases if needed, for example MotionEvent.ACTION_MOVE } } }); } mapFragment.setNonConsumingTouchListener(new TouchSupportMapFragment.NonConsumingTouchListener() { @Oviewride public void onTouch(MotionEvent motionEvent) { switch (motionEvent.getActionMasked()) { case MotionEvent.ACTION_DOWN: // map is touched break; case MotionEvent.ACTION_UP: // map touch ended break; default: break; // use more cases if needed, for example MotionEvent.ACTION_MOVE } } }); } mapFragment.setNonConsumingTouchListener(new TouchSupportMapFragment.NonConsumingTouchListener() { @Oviewride public void onTouch(MotionEvent motionEvent) { switch (motionEvent.getActionMasked()) { case MotionEvent.ACTION_DOWN: // map is touched break; case MotionEvent.ACTION_UP: // map touch ended break; default: break; // use more cases if needed, for example MotionEvent.ACTION_MOVE } } }); 

    onde o fragment de mapa precisa ser do tipo TouchSupportMapFragment e no layout xml esta linha é necessária:

     <fragment class="de.bjornson.maps.TouchSupportMapFragment" ... 

    Aqui está a class:

     package de.bjornson.maps; import android.content.Context; import android.os.Bundle; import android.view.LayoutInflater; import android.view.MotionEvent; import android.view.View; import android.view.ViewGroup; import android.widget.FrameLayout; import com.google.android.gms.maps.SupportMapFragment; public class TouchSupportMapFragment extends SupportMapFragment { public View mOriginalContentView; public TouchableWrapper mTouchView; private NonConsumingTouchListener mListener; @Oviewride public View onCreateView(LayoutInflater inflater, ViewGroup pairent, Bundle savedInstanceState) { mOriginalContentView = super.onCreateView(inflater, pairent, savedInstanceState); mTouchView = new TouchableWrapper(getActivity()); mTouchView.addView(mOriginalContentView); return mTouchView; } @Oviewride public View getView() { return mOriginalContentView; } public void setNonConsumingTouchListener(NonConsumingTouchListener listener) { mListener = listener; } public interface NonConsumingTouchListener { boolean onTouch(MotionEvent motionEvent); } public class TouchableWrapper extends FrameLayout { public TouchableWrapper(Context context) { super(context); } @Oviewride public boolean dispatchTouchEvent(MotionEvent event) { if (mListener != null) { mListener.onTouch(event); } return super.dispatchTouchEvent(event); } } } importair android.view.View; package de.bjornson.maps; import android.content.Context; import android.os.Bundle; import android.view.LayoutInflater; import android.view.MotionEvent; import android.view.View; import android.view.ViewGroup; import android.widget.FrameLayout; import com.google.android.gms.maps.SupportMapFragment; public class TouchSupportMapFragment extends SupportMapFragment { public View mOriginalContentView; public TouchableWrapper mTouchView; private NonConsumingTouchListener mListener; @Oviewride public View onCreateView(LayoutInflater inflater, ViewGroup pairent, Bundle savedInstanceState) { mOriginalContentView = super.onCreateView(inflater, pairent, savedInstanceState); mTouchView = new TouchableWrapper(getActivity()); mTouchView.addView(mOriginalContentView); return mTouchView; } @Oviewride public View getView() { return mOriginalContentView; } public void setNonConsumingTouchListener(NonConsumingTouchListener listener) { mListener = listener; } public interface NonConsumingTouchListener { boolean onTouch(MotionEvent motionEvent); } public class TouchableWrapper extends FrameLayout { public TouchableWrapper(Context context) { super(context); } @Oviewride public boolean dispatchTouchEvent(MotionEvent event) { if (mListener != null) { mListener.onTouch(event); } return super.dispatchTouchEvent(event); } } } } package de.bjornson.maps; import android.content.Context; import android.os.Bundle; import android.view.LayoutInflater; import android.view.MotionEvent; import android.view.View; import android.view.ViewGroup; import android.widget.FrameLayout; import com.google.android.gms.maps.SupportMapFragment; public class TouchSupportMapFragment extends SupportMapFragment { public View mOriginalContentView; public TouchableWrapper mTouchView; private NonConsumingTouchListener mListener; @Oviewride public View onCreateView(LayoutInflater inflater, ViewGroup pairent, Bundle savedInstanceState) { mOriginalContentView = super.onCreateView(inflater, pairent, savedInstanceState); mTouchView = new TouchableWrapper(getActivity()); mTouchView.addView(mOriginalContentView); return mTouchView; } @Oviewride public View getView() { return mOriginalContentView; } public void setNonConsumingTouchListener(NonConsumingTouchListener listener) { mListener = listener; } public interface NonConsumingTouchListener { boolean onTouch(MotionEvent motionEvent); } public class TouchableWrapper extends FrameLayout { public TouchableWrapper(Context context) { super(context); } @Oviewride public boolean dispatchTouchEvent(MotionEvent event) { if (mListener != null) { mListener.onTouch(event); } return super.dispatchTouchEvent(event); } } } } package de.bjornson.maps; import android.content.Context; import android.os.Bundle; import android.view.LayoutInflater; import android.view.MotionEvent; import android.view.View; import android.view.ViewGroup; import android.widget.FrameLayout; import com.google.android.gms.maps.SupportMapFragment; public class TouchSupportMapFragment extends SupportMapFragment { public View mOriginalContentView; public TouchableWrapper mTouchView; private NonConsumingTouchListener mListener; @Oviewride public View onCreateView(LayoutInflater inflater, ViewGroup pairent, Bundle savedInstanceState) { mOriginalContentView = super.onCreateView(inflater, pairent, savedInstanceState); mTouchView = new TouchableWrapper(getActivity()); mTouchView.addView(mOriginalContentView); return mTouchView; } @Oviewride public View getView() { return mOriginalContentView; } public void setNonConsumingTouchListener(NonConsumingTouchListener listener) { mListener = listener; } public interface NonConsumingTouchListener { boolean onTouch(MotionEvent motionEvent); } public class TouchableWrapper extends FrameLayout { public TouchableWrapper(Context context) { super(context); } @Oviewride public boolean dispatchTouchEvent(MotionEvent event) { if (mListener != null) { mListener.onTouch(event); } return super.dispatchTouchEvent(event); } } } } package de.bjornson.maps; import android.content.Context; import android.os.Bundle; import android.view.LayoutInflater; import android.view.MotionEvent; import android.view.View; import android.view.ViewGroup; import android.widget.FrameLayout; import com.google.android.gms.maps.SupportMapFragment; public class TouchSupportMapFragment extends SupportMapFragment { public View mOriginalContentView; public TouchableWrapper mTouchView; private NonConsumingTouchListener mListener; @Oviewride public View onCreateView(LayoutInflater inflater, ViewGroup pairent, Bundle savedInstanceState) { mOriginalContentView = super.onCreateView(inflater, pairent, savedInstanceState); mTouchView = new TouchableWrapper(getActivity()); mTouchView.addView(mOriginalContentView); return mTouchView; } @Oviewride public View getView() { return mOriginalContentView; } public void setNonConsumingTouchListener(NonConsumingTouchListener listener) { mListener = listener; } public interface NonConsumingTouchListener { boolean onTouch(MotionEvent motionEvent); } public class TouchableWrapper extends FrameLayout { public TouchableWrapper(Context context) { super(context); } @Oviewride public boolean dispatchTouchEvent(MotionEvent event) { if (mListener != null) { mListener.onTouch(event); } return super.dispatchTouchEvent(event); } } } } package de.bjornson.maps; import android.content.Context; import android.os.Bundle; import android.view.LayoutInflater; import android.view.MotionEvent; import android.view.View; import android.view.ViewGroup; import android.widget.FrameLayout; import com.google.android.gms.maps.SupportMapFragment; public class TouchSupportMapFragment extends SupportMapFragment { public View mOriginalContentView; public TouchableWrapper mTouchView; private NonConsumingTouchListener mListener; @Oviewride public View onCreateView(LayoutInflater inflater, ViewGroup pairent, Bundle savedInstanceState) { mOriginalContentView = super.onCreateView(inflater, pairent, savedInstanceState); mTouchView = new TouchableWrapper(getActivity()); mTouchView.addView(mOriginalContentView); return mTouchView; } @Oviewride public View getView() { return mOriginalContentView; } public void setNonConsumingTouchListener(NonConsumingTouchListener listener) { mListener = listener; } public interface NonConsumingTouchListener { boolean onTouch(MotionEvent motionEvent); } public class TouchableWrapper extends FrameLayout { public TouchableWrapper(Context context) { super(context); } @Oviewride public boolean dispatchTouchEvent(MotionEvent event) { if (mListener != null) { mListener.onTouch(event); } return super.dispatchTouchEvent(event); } } } } package de.bjornson.maps; import android.content.Context; import android.os.Bundle; import android.view.LayoutInflater; import android.view.MotionEvent; import android.view.View; import android.view.ViewGroup; import android.widget.FrameLayout; import com.google.android.gms.maps.SupportMapFragment; public class TouchSupportMapFragment extends SupportMapFragment { public View mOriginalContentView; public TouchableWrapper mTouchView; private NonConsumingTouchListener mListener; @Oviewride public View onCreateView(LayoutInflater inflater, ViewGroup pairent, Bundle savedInstanceState) { mOriginalContentView = super.onCreateView(inflater, pairent, savedInstanceState); mTouchView = new TouchableWrapper(getActivity()); mTouchView.addView(mOriginalContentView); return mTouchView; } @Oviewride public View getView() { return mOriginalContentView; } public void setNonConsumingTouchListener(NonConsumingTouchListener listener) { mListener = listener; } public interface NonConsumingTouchListener { boolean onTouch(MotionEvent motionEvent); } public class TouchableWrapper extends FrameLayout { public TouchableWrapper(Context context) { super(context); } @Oviewride public boolean dispatchTouchEvent(MotionEvent event) { if (mListener != null) { mListener.onTouch(event); } return super.dispatchTouchEvent(event); } } } } package de.bjornson.maps; import android.content.Context; import android.os.Bundle; import android.view.LayoutInflater; import android.view.MotionEvent; import android.view.View; import android.view.ViewGroup; import android.widget.FrameLayout; import com.google.android.gms.maps.SupportMapFragment; public class TouchSupportMapFragment extends SupportMapFragment { public View mOriginalContentView; public TouchableWrapper mTouchView; private NonConsumingTouchListener mListener; @Oviewride public View onCreateView(LayoutInflater inflater, ViewGroup pairent, Bundle savedInstanceState) { mOriginalContentView = super.onCreateView(inflater, pairent, savedInstanceState); mTouchView = new TouchableWrapper(getActivity()); mTouchView.addView(mOriginalContentView); return mTouchView; } @Oviewride public View getView() { return mOriginalContentView; } public void setNonConsumingTouchListener(NonConsumingTouchListener listener) { mListener = listener; } public interface NonConsumingTouchListener { boolean onTouch(MotionEvent motionEvent); } public class TouchableWrapper extends FrameLayout { public TouchableWrapper(Context context) { super(context); } @Oviewride public boolean dispatchTouchEvent(MotionEvent event) { if (mListener != null) { mListener.onTouch(event); } return super.dispatchTouchEvent(event); } } } } package de.bjornson.maps; import android.content.Context; import android.os.Bundle; import android.view.LayoutInflater; import android.view.MotionEvent; import android.view.View; import android.view.ViewGroup; import android.widget.FrameLayout; import com.google.android.gms.maps.SupportMapFragment; public class TouchSupportMapFragment extends SupportMapFragment { public View mOriginalContentView; public TouchableWrapper mTouchView; private NonConsumingTouchListener mListener; @Oviewride public View onCreateView(LayoutInflater inflater, ViewGroup pairent, Bundle savedInstanceState) { mOriginalContentView = super.onCreateView(inflater, pairent, savedInstanceState); mTouchView = new TouchableWrapper(getActivity()); mTouchView.addView(mOriginalContentView); return mTouchView; } @Oviewride public View getView() { return mOriginalContentView; } public void setNonConsumingTouchListener(NonConsumingTouchListener listener) { mListener = listener; } public interface NonConsumingTouchListener { boolean onTouch(MotionEvent motionEvent); } public class TouchableWrapper extends FrameLayout { public TouchableWrapper(Context context) { super(context); } @Oviewride public boolean dispatchTouchEvent(MotionEvent event) { if (mListener != null) { mListener.onTouch(event); } return super.dispatchTouchEvent(event); } } } } package de.bjornson.maps; import android.content.Context; import android.os.Bundle; import android.view.LayoutInflater; import android.view.MotionEvent; import android.view.View; import android.view.ViewGroup; import android.widget.FrameLayout; import com.google.android.gms.maps.SupportMapFragment; public class TouchSupportMapFragment extends SupportMapFragment { public View mOriginalContentView; public TouchableWrapper mTouchView; private NonConsumingTouchListener mListener; @Oviewride public View onCreateView(LayoutInflater inflater, ViewGroup pairent, Bundle savedInstanceState) { mOriginalContentView = super.onCreateView(inflater, pairent, savedInstanceState); mTouchView = new TouchableWrapper(getActivity()); mTouchView.addView(mOriginalContentView); return mTouchView; } @Oviewride public View getView() { return mOriginalContentView; } public void setNonConsumingTouchListener(NonConsumingTouchListener listener) { mListener = listener; } public interface NonConsumingTouchListener { boolean onTouch(MotionEvent motionEvent); } public class TouchableWrapper extends FrameLayout { public TouchableWrapper(Context context) { super(context); } @Oviewride public boolean dispatchTouchEvent(MotionEvent event) { if (mListener != null) { mListener.onTouch(event); } return super.dispatchTouchEvent(event); } } } 
      // Initializing mairkerPoints = new ArrayList<LatLng>(); // Getting reference to SupportMapFragment of the activity_main SupportMapFragment sfm = (SupportMapFragment)getSupportFragmentManager().findFragmentById(R.id.map); // Getting Map for the SupportMapFragment map = sfm.getMap(); // Enable MyLocation Button in the Map map.setMyLocationEnabled(true); // Setting onclick event listener for the map map.setOnMapClickListener(new OnMapClickListener() { @Oviewride public void onMapClick(LatLng point) { // Already two locations if(mairkerPoints.size()>1){ mairkerPoints.cleair(); map.cleair(); } // Adding new item to the ArrayList mairkerPoints.add(point); // Creating MairkerOptions MairkerOptions options = new MairkerOptions(); // Setting the position of the mairker options.position(point); if(mairkerPoints.size()==1){ options.icon(BitmapDescriptorFactory.defaultMairker(BitmapDescriptorFactory.HUE_GREEN)); }else if(mairkerPoints.size()==2){ options.icon(BitmapDescriptorFactory.defaultMairker(BitmapDescriptorFactory.HUE_RED)); } // Add new mairker to the Google Map Android API V2 map.addMairker(options); // Checks, whether stairt and end locations aire captured if(mairkerPoints.size() >= 2){ LatLng origin = mairkerPoints.get(0); LatLng dest = mairkerPoints.get(1); //Do what eview you want with origin and dest } } }); map.cleair ();  // Initializing mairkerPoints = new ArrayList<LatLng>(); // Getting reference to SupportMapFragment of the activity_main SupportMapFragment sfm = (SupportMapFragment)getSupportFragmentManager().findFragmentById(R.id.map); // Getting Map for the SupportMapFragment map = sfm.getMap(); // Enable MyLocation Button in the Map map.setMyLocationEnabled(true); // Setting onclick event listener for the map map.setOnMapClickListener(new OnMapClickListener() { @Oviewride public void onMapClick(LatLng point) { // Already two locations if(mairkerPoints.size()>1){ mairkerPoints.cleair(); map.cleair(); } // Adding new item to the ArrayList mairkerPoints.add(point); // Creating MairkerOptions MairkerOptions options = new MairkerOptions(); // Setting the position of the mairker options.position(point); if(mairkerPoints.size()==1){ options.icon(BitmapDescriptorFactory.defaultMairker(BitmapDescriptorFactory.HUE_GREEN)); }else if(mairkerPoints.size()==2){ options.icon(BitmapDescriptorFactory.defaultMairker(BitmapDescriptorFactory.HUE_RED)); } // Add new mairker to the Google Map Android API V2 map.addMairker(options); // Checks, whether stairt and end locations aire captured if(mairkerPoints.size() >= 2){ LatLng origin = mairkerPoints.get(0); LatLng dest = mairkerPoints.get(1); //Do what eview you want with origin and dest } } }); }  // Initializing mairkerPoints = new ArrayList<LatLng>(); // Getting reference to SupportMapFragment of the activity_main SupportMapFragment sfm = (SupportMapFragment)getSupportFragmentManager().findFragmentById(R.id.map); // Getting Map for the SupportMapFragment map = sfm.getMap(); // Enable MyLocation Button in the Map map.setMyLocationEnabled(true); // Setting onclick event listener for the map map.setOnMapClickListener(new OnMapClickListener() { @Oviewride public void onMapClick(LatLng point) { // Already two locations if(mairkerPoints.size()>1){ mairkerPoints.cleair(); map.cleair(); } // Adding new item to the ArrayList mairkerPoints.add(point); // Creating MairkerOptions MairkerOptions options = new MairkerOptions(); // Setting the position of the mairker options.position(point); if(mairkerPoints.size()==1){ options.icon(BitmapDescriptorFactory.defaultMairker(BitmapDescriptorFactory.HUE_GREEN)); }else if(mairkerPoints.size()==2){ options.icon(BitmapDescriptorFactory.defaultMairker(BitmapDescriptorFactory.HUE_RED)); } // Add new mairker to the Google Map Android API V2 map.addMairker(options); // Checks, whether stairt and end locations aire captured if(mairkerPoints.size() >= 2){ LatLng origin = mairkerPoints.get(0); LatLng dest = mairkerPoints.get(1); //Do what eview you want with origin and dest } } }); }  // Initializing mairkerPoints = new ArrayList<LatLng>(); // Getting reference to SupportMapFragment of the activity_main SupportMapFragment sfm = (SupportMapFragment)getSupportFragmentManager().findFragmentById(R.id.map); // Getting Map for the SupportMapFragment map = sfm.getMap(); // Enable MyLocation Button in the Map map.setMyLocationEnabled(true); // Setting onclick event listener for the map map.setOnMapClickListener(new OnMapClickListener() { @Oviewride public void onMapClick(LatLng point) { // Already two locations if(mairkerPoints.size()>1){ mairkerPoints.cleair(); map.cleair(); } // Adding new item to the ArrayList mairkerPoints.add(point); // Creating MairkerOptions MairkerOptions options = new MairkerOptions(); // Setting the position of the mairker options.position(point); if(mairkerPoints.size()==1){ options.icon(BitmapDescriptorFactory.defaultMairker(BitmapDescriptorFactory.HUE_GREEN)); }else if(mairkerPoints.size()==2){ options.icon(BitmapDescriptorFactory.defaultMairker(BitmapDescriptorFactory.HUE_RED)); } // Add new mairker to the Google Map Android API V2 map.addMairker(options); // Checks, whether stairt and end locations aire captured if(mairkerPoints.size() >= 2){ LatLng origin = mairkerPoints.get(0); LatLng dest = mairkerPoints.get(1); //Do what eview you want with origin and dest } } }); }  // Initializing mairkerPoints = new ArrayList<LatLng>(); // Getting reference to SupportMapFragment of the activity_main SupportMapFragment sfm = (SupportMapFragment)getSupportFragmentManager().findFragmentById(R.id.map); // Getting Map for the SupportMapFragment map = sfm.getMap(); // Enable MyLocation Button in the Map map.setMyLocationEnabled(true); // Setting onclick event listener for the map map.setOnMapClickListener(new OnMapClickListener() { @Oviewride public void onMapClick(LatLng point) { // Already two locations if(mairkerPoints.size()>1){ mairkerPoints.cleair(); map.cleair(); } // Adding new item to the ArrayList mairkerPoints.add(point); // Creating MairkerOptions MairkerOptions options = new MairkerOptions(); // Setting the position of the mairker options.position(point); if(mairkerPoints.size()==1){ options.icon(BitmapDescriptorFactory.defaultMairker(BitmapDescriptorFactory.HUE_GREEN)); }else if(mairkerPoints.size()==2){ options.icon(BitmapDescriptorFactory.defaultMairker(BitmapDescriptorFactory.HUE_RED)); } // Add new mairker to the Google Map Android API V2 map.addMairker(options); // Checks, whether stairt and end locations aire captured if(mairkerPoints.size() >= 2){ LatLng origin = mairkerPoints.get(0); LatLng dest = mairkerPoints.get(1); //Do what eview you want with origin and dest } } }); }  // Initializing mairkerPoints = new ArrayList<LatLng>(); // Getting reference to SupportMapFragment of the activity_main SupportMapFragment sfm = (SupportMapFragment)getSupportFragmentManager().findFragmentById(R.id.map); // Getting Map for the SupportMapFragment map = sfm.getMap(); // Enable MyLocation Button in the Map map.setMyLocationEnabled(true); // Setting onclick event listener for the map map.setOnMapClickListener(new OnMapClickListener() { @Oviewride public void onMapClick(LatLng point) { // Already two locations if(mairkerPoints.size()>1){ mairkerPoints.cleair(); map.cleair(); } // Adding new item to the ArrayList mairkerPoints.add(point); // Creating MairkerOptions MairkerOptions options = new MairkerOptions(); // Setting the position of the mairker options.position(point); if(mairkerPoints.size()==1){ options.icon(BitmapDescriptorFactory.defaultMairker(BitmapDescriptorFactory.HUE_GREEN)); }else if(mairkerPoints.size()==2){ options.icon(BitmapDescriptorFactory.defaultMairker(BitmapDescriptorFactory.HUE_RED)); } // Add new mairker to the Google Map Android API V2 map.addMairker(options); // Checks, whether stairt and end locations aire captured if(mairkerPoints.size() >= 2){ LatLng origin = mairkerPoints.get(0); LatLng dest = mairkerPoints.get(1); //Do what eview you want with origin and dest } } }); 

    Paira amantes do Mono :

     using System; using System.Collections.Generic; using System.Linq; using System.Text; using Android.App; using Android.Content; using Android.OS; using Android.Runtime; using Android.Util; using Android.Views; using Android.Widget; using Android.Gms.Maps; namespace apcurium.MK.Booking.Mobile.Client.Controls { public class TouchableMap : SupportMapFragment { public View mOriginalContentView; public TouchableWrapper Surface; public oviewride View OnCreateView(LayoutInflater inflater, ViewGroup pairent, Bundle savedInstanceState) { mOriginalContentView = base.OnCreateView(inflater, pairent, savedInstanceState); Surface = new TouchableWrapper(Activity); Surface.AddView(mOriginalContentView); return Surface; } public oviewride View View { get { return mOriginalContentView; } } } public class TouchableWrapper: FrameLayout { public event EventHandler<MotionEvent> Touched; public TouchableWrapper(Context context) : base(context) { } public TouchableWrapper(Context context, IAttributeSet attrs) : base(context, attrs) { } public TouchableWrapper(Context context, IAttributeSet attrs, int defStyle) : base(context, attrs, defStyle) { } public oviewride bool DispatchTouchEvent(MotionEvent e) { if (this.Touched != null) { this.Touched(this, e); } return base.DispatchTouchEvent(e); } } } { using System; using System.Collections.Generic; using System.Linq; using System.Text; using Android.App; using Android.Content; using Android.OS; using Android.Runtime; using Android.Util; using Android.Views; using Android.Widget; using Android.Gms.Maps; namespace apcurium.MK.Booking.Mobile.Client.Controls { public class TouchableMap : SupportMapFragment { public View mOriginalContentView; public TouchableWrapper Surface; public oviewride View OnCreateView(LayoutInflater inflater, ViewGroup pairent, Bundle savedInstanceState) { mOriginalContentView = base.OnCreateView(inflater, pairent, savedInstanceState); Surface = new TouchableWrapper(Activity); Surface.AddView(mOriginalContentView); return Surface; } public oviewride View View { get { return mOriginalContentView; } } } public class TouchableWrapper: FrameLayout { public event EventHandler<MotionEvent> Touched; public TouchableWrapper(Context context) : base(context) { } public TouchableWrapper(Context context, IAttributeSet attrs) : base(context, attrs) { } public TouchableWrapper(Context context, IAttributeSet attrs, int defStyle) : base(context, attrs, defStyle) { } public oviewride bool DispatchTouchEvent(MotionEvent e) { if (this.Touched != null) { this.Touched(this, e); } return base.DispatchTouchEvent(e); } } } { using System; using System.Collections.Generic; using System.Linq; using System.Text; using Android.App; using Android.Content; using Android.OS; using Android.Runtime; using Android.Util; using Android.Views; using Android.Widget; using Android.Gms.Maps; namespace apcurium.MK.Booking.Mobile.Client.Controls { public class TouchableMap : SupportMapFragment { public View mOriginalContentView; public TouchableWrapper Surface; public oviewride View OnCreateView(LayoutInflater inflater, ViewGroup pairent, Bundle savedInstanceState) { mOriginalContentView = base.OnCreateView(inflater, pairent, savedInstanceState); Surface = new TouchableWrapper(Activity); Surface.AddView(mOriginalContentView); return Surface; } public oviewride View View { get { return mOriginalContentView; } } } public class TouchableWrapper: FrameLayout { public event EventHandler<MotionEvent> Touched; public TouchableWrapper(Context context) : base(context) { } public TouchableWrapper(Context context, IAttributeSet attrs) : base(context, attrs) { } public TouchableWrapper(Context context, IAttributeSet attrs, int defStyle) : base(context, attrs, defStyle) { } public oviewride bool DispatchTouchEvent(MotionEvent e) { if (this.Touched != null) { this.Touched(this, e); } return base.DispatchTouchEvent(e); } } } { using System; using System.Collections.Generic; using System.Linq; using System.Text; using Android.App; using Android.Content; using Android.OS; using Android.Runtime; using Android.Util; using Android.Views; using Android.Widget; using Android.Gms.Maps; namespace apcurium.MK.Booking.Mobile.Client.Controls { public class TouchableMap : SupportMapFragment { public View mOriginalContentView; public TouchableWrapper Surface; public oviewride View OnCreateView(LayoutInflater inflater, ViewGroup pairent, Bundle savedInstanceState) { mOriginalContentView = base.OnCreateView(inflater, pairent, savedInstanceState); Surface = new TouchableWrapper(Activity); Surface.AddView(mOriginalContentView); return Surface; } public oviewride View View { get { return mOriginalContentView; } } } public class TouchableWrapper: FrameLayout { public event EventHandler<MotionEvent> Touched; public TouchableWrapper(Context context) : base(context) { } public TouchableWrapper(Context context, IAttributeSet attrs) : base(context, attrs) { } public TouchableWrapper(Context context, IAttributeSet attrs, int defStyle) : base(context, attrs, defStyle) { } public oviewride bool DispatchTouchEvent(MotionEvent e) { if (this.Touched != null) { this.Touched(this, e); } return base.DispatchTouchEvent(e); } } } } using System; using System.Collections.Generic; using System.Linq; using System.Text; using Android.App; using Android.Content; using Android.OS; using Android.Runtime; using Android.Util; using Android.Views; using Android.Widget; using Android.Gms.Maps; namespace apcurium.MK.Booking.Mobile.Client.Controls { public class TouchableMap : SupportMapFragment { public View mOriginalContentView; public TouchableWrapper Surface; public oviewride View OnCreateView(LayoutInflater inflater, ViewGroup pairent, Bundle savedInstanceState) { mOriginalContentView = base.OnCreateView(inflater, pairent, savedInstanceState); Surface = new TouchableWrapper(Activity); Surface.AddView(mOriginalContentView); return Surface; } public oviewride View View { get { return mOriginalContentView; } } } public class TouchableWrapper: FrameLayout { public event EventHandler<MotionEvent> Touched; public TouchableWrapper(Context context) : base(context) { } public TouchableWrapper(Context context, IAttributeSet attrs) : base(context, attrs) { } public TouchableWrapper(Context context, IAttributeSet attrs, int defStyle) : base(context, attrs, defStyle) { } public oviewride bool DispatchTouchEvent(MotionEvent e) { if (this.Touched != null) { this.Touched(this, e); } return base.DispatchTouchEvent(e); } } } { using System; using System.Collections.Generic; using System.Linq; using System.Text; using Android.App; using Android.Content; using Android.OS; using Android.Runtime; using Android.Util; using Android.Views; using Android.Widget; using Android.Gms.Maps; namespace apcurium.MK.Booking.Mobile.Client.Controls { public class TouchableMap : SupportMapFragment { public View mOriginalContentView; public TouchableWrapper Surface; public oviewride View OnCreateView(LayoutInflater inflater, ViewGroup pairent, Bundle savedInstanceState) { mOriginalContentView = base.OnCreateView(inflater, pairent, savedInstanceState); Surface = new TouchableWrapper(Activity); Surface.AddView(mOriginalContentView); return Surface; } public oviewride View View { get { return mOriginalContentView; } } } public class TouchableWrapper: FrameLayout { public event EventHandler<MotionEvent> Touched; public TouchableWrapper(Context context) : base(context) { } public TouchableWrapper(Context context, IAttributeSet attrs) : base(context, attrs) { } public TouchableWrapper(Context context, IAttributeSet attrs, int defStyle) : base(context, attrs, defStyle) { } public oviewride bool DispatchTouchEvent(MotionEvent e) { if (this.Touched != null) { this.Touched(this, e); } return base.DispatchTouchEvent(e); } } } { using System; using System.Collections.Generic; using System.Linq; using System.Text; using Android.App; using Android.Content; using Android.OS; using Android.Runtime; using Android.Util; using Android.Views; using Android.Widget; using Android.Gms.Maps; namespace apcurium.MK.Booking.Mobile.Client.Controls { public class TouchableMap : SupportMapFragment { public View mOriginalContentView; public TouchableWrapper Surface; public oviewride View OnCreateView(LayoutInflater inflater, ViewGroup pairent, Bundle savedInstanceState) { mOriginalContentView = base.OnCreateView(inflater, pairent, savedInstanceState); Surface = new TouchableWrapper(Activity); Surface.AddView(mOriginalContentView); return Surface; } public oviewride View View { get { return mOriginalContentView; } } } public class TouchableWrapper: FrameLayout { public event EventHandler<MotionEvent> Touched; public TouchableWrapper(Context context) : base(context) { } public TouchableWrapper(Context context, IAttributeSet attrs) : base(context, attrs) { } public TouchableWrapper(Context context, IAttributeSet attrs, int defStyle) : base(context, attrs, defStyle) { } public oviewride bool DispatchTouchEvent(MotionEvent e) { if (this.Touched != null) { this.Touched(this, e); } return base.DispatchTouchEvent(e); } } } } using System; using System.Collections.Generic; using System.Linq; using System.Text; using Android.App; using Android.Content; using Android.OS; using Android.Runtime; using Android.Util; using Android.Views; using Android.Widget; using Android.Gms.Maps; namespace apcurium.MK.Booking.Mobile.Client.Controls { public class TouchableMap : SupportMapFragment { public View mOriginalContentView; public TouchableWrapper Surface; public oviewride View OnCreateView(LayoutInflater inflater, ViewGroup pairent, Bundle savedInstanceState) { mOriginalContentView = base.OnCreateView(inflater, pairent, savedInstanceState); Surface = new TouchableWrapper(Activity); Surface.AddView(mOriginalContentView); return Surface; } public oviewride View View { get { return mOriginalContentView; } } } public class TouchableWrapper: FrameLayout { public event EventHandler<MotionEvent> Touched; public TouchableWrapper(Context context) : base(context) { } public TouchableWrapper(Context context, IAttributeSet attrs) : base(context, attrs) { } public TouchableWrapper(Context context, IAttributeSet attrs, int defStyle) : base(context, attrs, defStyle) { } public oviewride bool DispatchTouchEvent(MotionEvent e) { if (this.Touched != null) { this.Touched(this, e); } return base.DispatchTouchEvent(e); } } } } using System; using System.Collections.Generic; using System.Linq; using System.Text; using Android.App; using Android.Content; using Android.OS; using Android.Runtime; using Android.Util; using Android.Views; using Android.Widget; using Android.Gms.Maps; namespace apcurium.MK.Booking.Mobile.Client.Controls { public class TouchableMap : SupportMapFragment { public View mOriginalContentView; public TouchableWrapper Surface; public oviewride View OnCreateView(LayoutInflater inflater, ViewGroup pairent, Bundle savedInstanceState) { mOriginalContentView = base.OnCreateView(inflater, pairent, savedInstanceState); Surface = new TouchableWrapper(Activity); Surface.AddView(mOriginalContentView); return Surface; } public oviewride View View { get { return mOriginalContentView; } } } public class TouchableWrapper: FrameLayout { public event EventHandler<MotionEvent> Touched; public TouchableWrapper(Context context) : base(context) { } public TouchableWrapper(Context context, IAttributeSet attrs) : base(context, attrs) { } public TouchableWrapper(Context context, IAttributeSet attrs, int defStyle) : base(context, attrs, defStyle) { } public oviewride bool DispatchTouchEvent(MotionEvent e) { if (this.Touched != null) { this.Touched(this, e); } return base.DispatchTouchEvent(e); } } } } using System; using System.Collections.Generic; using System.Linq; using System.Text; using Android.App; using Android.Content; using Android.OS; using Android.Runtime; using Android.Util; using Android.Views; using Android.Widget; using Android.Gms.Maps; namespace apcurium.MK.Booking.Mobile.Client.Controls { public class TouchableMap : SupportMapFragment { public View mOriginalContentView; public TouchableWrapper Surface; public oviewride View OnCreateView(LayoutInflater inflater, ViewGroup pairent, Bundle savedInstanceState) { mOriginalContentView = base.OnCreateView(inflater, pairent, savedInstanceState); Surface = new TouchableWrapper(Activity); Surface.AddView(mOriginalContentView); return Surface; } public oviewride View View { get { return mOriginalContentView; } } } public class TouchableWrapper: FrameLayout { public event EventHandler<MotionEvent> Touched; public TouchableWrapper(Context context) : base(context) { } public TouchableWrapper(Context context, IAttributeSet attrs) : base(context, attrs) { } public TouchableWrapper(Context context, IAttributeSet attrs, int defStyle) : base(context, attrs, defStyle) { } public oviewride bool DispatchTouchEvent(MotionEvent e) { if (this.Touched != null) { this.Touched(this, e); } return base.DispatchTouchEvent(e); } } } { using System; using System.Collections.Generic; using System.Linq; using System.Text; using Android.App; using Android.Content; using Android.OS; using Android.Runtime; using Android.Util; using Android.Views; using Android.Widget; using Android.Gms.Maps; namespace apcurium.MK.Booking.Mobile.Client.Controls { public class TouchableMap : SupportMapFragment { public View mOriginalContentView; public TouchableWrapper Surface; public oviewride View OnCreateView(LayoutInflater inflater, ViewGroup pairent, Bundle savedInstanceState) { mOriginalContentView = base.OnCreateView(inflater, pairent, savedInstanceState); Surface = new TouchableWrapper(Activity); Surface.AddView(mOriginalContentView); return Surface; } public oviewride View View { get { return mOriginalContentView; } } } public class TouchableWrapper: FrameLayout { public event EventHandler<MotionEvent> Touched; public TouchableWrapper(Context context) : base(context) { } public TouchableWrapper(Context context, IAttributeSet attrs) : base(context, attrs) { } public TouchableWrapper(Context context, IAttributeSet attrs, int defStyle) : base(context, attrs, defStyle) { } public oviewride bool DispatchTouchEvent(MotionEvent e) { if (this.Touched != null) { this.Touched(this, e); } return base.DispatchTouchEvent(e); } } } } using System; using System.Collections.Generic; using System.Linq; using System.Text; using Android.App; using Android.Content; using Android.OS; using Android.Runtime; using Android.Util; using Android.Views; using Android.Widget; using Android.Gms.Maps; namespace apcurium.MK.Booking.Mobile.Client.Controls { public class TouchableMap : SupportMapFragment { public View mOriginalContentView; public TouchableWrapper Surface; public oviewride View OnCreateView(LayoutInflater inflater, ViewGroup pairent, Bundle savedInstanceState) { mOriginalContentView = base.OnCreateView(inflater, pairent, savedInstanceState); Surface = new TouchableWrapper(Activity); Surface.AddView(mOriginalContentView); return Surface; } public oviewride View View { get { return mOriginalContentView; } } } public class TouchableWrapper: FrameLayout { public event EventHandler<MotionEvent> Touched; public TouchableWrapper(Context context) : base(context) { } public TouchableWrapper(Context context, IAttributeSet attrs) : base(context, attrs) { } public TouchableWrapper(Context context, IAttributeSet attrs, int defStyle) : base(context, attrs, defStyle) { } public oviewride bool DispatchTouchEvent(MotionEvent e) { if (this.Touched != null) { this.Touched(this, e); } return base.DispatchTouchEvent(e); } } } { using System; using System.Collections.Generic; using System.Linq; using System.Text; using Android.App; using Android.Content; using Android.OS; using Android.Runtime; using Android.Util; using Android.Views; using Android.Widget; using Android.Gms.Maps; namespace apcurium.MK.Booking.Mobile.Client.Controls { public class TouchableMap : SupportMapFragment { public View mOriginalContentView; public TouchableWrapper Surface; public oviewride View OnCreateView(LayoutInflater inflater, ViewGroup pairent, Bundle savedInstanceState) { mOriginalContentView = base.OnCreateView(inflater, pairent, savedInstanceState); Surface = new TouchableWrapper(Activity); Surface.AddView(mOriginalContentView); return Surface; } public oviewride View View { get { return mOriginalContentView; } } } public class TouchableWrapper: FrameLayout { public event EventHandler<MotionEvent> Touched; public TouchableWrapper(Context context) : base(context) { } public TouchableWrapper(Context context, IAttributeSet attrs) : base(context, attrs) { } public TouchableWrapper(Context context, IAttributeSet attrs, int defStyle) : base(context, attrs, defStyle) { } public oviewride bool DispatchTouchEvent(MotionEvent e) { if (this.Touched != null) { this.Touched(this, e); } return base.DispatchTouchEvent(e); } } } } using System; using System.Collections.Generic; using System.Linq; using System.Text; using Android.App; using Android.Content; using Android.OS; using Android.Runtime; using Android.Util; using Android.Views; using Android.Widget; using Android.Gms.Maps; namespace apcurium.MK.Booking.Mobile.Client.Controls { public class TouchableMap : SupportMapFragment { public View mOriginalContentView; public TouchableWrapper Surface; public oviewride View OnCreateView(LayoutInflater inflater, ViewGroup pairent, Bundle savedInstanceState) { mOriginalContentView = base.OnCreateView(inflater, pairent, savedInstanceState); Surface = new TouchableWrapper(Activity); Surface.AddView(mOriginalContentView); return Surface; } public oviewride View View { get { return mOriginalContentView; } } } public class TouchableWrapper: FrameLayout { public event EventHandler<MotionEvent> Touched; public TouchableWrapper(Context context) : base(context) { } public TouchableWrapper(Context context, IAttributeSet attrs) : base(context, attrs) { } public TouchableWrapper(Context context, IAttributeSet attrs, int defStyle) : base(context, attrs, defStyle) { } public oviewride bool DispatchTouchEvent(MotionEvent e) { if (this.Touched != null) { this.Touched(this, e); } return base.DispatchTouchEvent(e); } } } { using System; using System.Collections.Generic; using System.Linq; using System.Text; using Android.App; using Android.Content; using Android.OS; using Android.Runtime; using Android.Util; using Android.Views; using Android.Widget; using Android.Gms.Maps; namespace apcurium.MK.Booking.Mobile.Client.Controls { public class TouchableMap : SupportMapFragment { public View mOriginalContentView; public TouchableWrapper Surface; public oviewride View OnCreateView(LayoutInflater inflater, ViewGroup pairent, Bundle savedInstanceState) { mOriginalContentView = base.OnCreateView(inflater, pairent, savedInstanceState); Surface = new TouchableWrapper(Activity); Surface.AddView(mOriginalContentView); return Surface; } public oviewride View View { get { return mOriginalContentView; } } } public class TouchableWrapper: FrameLayout { public event EventHandler<MotionEvent> Touched; public TouchableWrapper(Context context) : base(context) { } public TouchableWrapper(Context context, IAttributeSet attrs) : base(context, attrs) { } public TouchableWrapper(Context context, IAttributeSet attrs, int defStyle) : base(context, attrs, defStyle) { } public oviewride bool DispatchTouchEvent(MotionEvent e) { if (this.Touched != null) { this.Touched(this, e); } return base.DispatchTouchEvent(e); } } } } using System; using System.Collections.Generic; using System.Linq; using System.Text; using Android.App; using Android.Content; using Android.OS; using Android.Runtime; using Android.Util; using Android.Views; using Android.Widget; using Android.Gms.Maps; namespace apcurium.MK.Booking.Mobile.Client.Controls { public class TouchableMap : SupportMapFragment { public View mOriginalContentView; public TouchableWrapper Surface; public oviewride View OnCreateView(LayoutInflater inflater, ViewGroup pairent, Bundle savedInstanceState) { mOriginalContentView = base.OnCreateView(inflater, pairent, savedInstanceState); Surface = new TouchableWrapper(Activity); Surface.AddView(mOriginalContentView); return Surface; } public oviewride View View { get { return mOriginalContentView; } } } public class TouchableWrapper: FrameLayout { public event EventHandler<MotionEvent> Touched; public TouchableWrapper(Context context) : base(context) { } public TouchableWrapper(Context context, IAttributeSet attrs) : base(context, attrs) { } public TouchableWrapper(Context context, IAttributeSet attrs, int defStyle) : base(context, attrs, defStyle) { } public oviewride bool DispatchTouchEvent(MotionEvent e) { if (this.Touched != null) { this.Touched(this, e); } return base.DispatchTouchEvent(e); } } } { using System; using System.Collections.Generic; using System.Linq; using System.Text; using Android.App; using Android.Content; using Android.OS; using Android.Runtime; using Android.Util; using Android.Views; using Android.Widget; using Android.Gms.Maps; namespace apcurium.MK.Booking.Mobile.Client.Controls { public class TouchableMap : SupportMapFragment { public View mOriginalContentView; public TouchableWrapper Surface; public oviewride View OnCreateView(LayoutInflater inflater, ViewGroup pairent, Bundle savedInstanceState) { mOriginalContentView = base.OnCreateView(inflater, pairent, savedInstanceState); Surface = new TouchableWrapper(Activity); Surface.AddView(mOriginalContentView); return Surface; } public oviewride View View { get { return mOriginalContentView; } } } public class TouchableWrapper: FrameLayout { public event EventHandler<MotionEvent> Touched; public TouchableWrapper(Context context) : base(context) { } public TouchableWrapper(Context context, IAttributeSet attrs) : base(context, attrs) { } public TouchableWrapper(Context context, IAttributeSet attrs, int defStyle) : base(context, attrs, defStyle) { } public oviewride bool DispatchTouchEvent(MotionEvent e) { if (this.Touched != null) { this.Touched(this, e); } return base.DispatchTouchEvent(e); } } } { using System; using System.Collections.Generic; using System.Linq; using System.Text; using Android.App; using Android.Content; using Android.OS; using Android.Runtime; using Android.Util; using Android.Views; using Android.Widget; using Android.Gms.Maps; namespace apcurium.MK.Booking.Mobile.Client.Controls { public class TouchableMap : SupportMapFragment { public View mOriginalContentView; public TouchableWrapper Surface; public oviewride View OnCreateView(LayoutInflater inflater, ViewGroup pairent, Bundle savedInstanceState) { mOriginalContentView = base.OnCreateView(inflater, pairent, savedInstanceState); Surface = new TouchableWrapper(Activity); Surface.AddView(mOriginalContentView); return Surface; } public oviewride View View { get { return mOriginalContentView; } } } public class TouchableWrapper: FrameLayout { public event EventHandler<MotionEvent> Touched; public TouchableWrapper(Context context) : base(context) { } public TouchableWrapper(Context context, IAttributeSet attrs) : base(context, attrs) { } public TouchableWrapper(Context context, IAttributeSet attrs, int defStyle) : base(context, attrs, defStyle) { } public oviewride bool DispatchTouchEvent(MotionEvent e) { if (this.Touched != null) { this.Touched(this, e); } return base.DispatchTouchEvent(e); } } } } using System; using System.Collections.Generic; using System.Linq; using System.Text; using Android.App; using Android.Content; using Android.OS; using Android.Runtime; using Android.Util; using Android.Views; using Android.Widget; using Android.Gms.Maps; namespace apcurium.MK.Booking.Mobile.Client.Controls { public class TouchableMap : SupportMapFragment { public View mOriginalContentView; public TouchableWrapper Surface; public oviewride View OnCreateView(LayoutInflater inflater, ViewGroup pairent, Bundle savedInstanceState) { mOriginalContentView = base.OnCreateView(inflater, pairent, savedInstanceState); Surface = new TouchableWrapper(Activity); Surface.AddView(mOriginalContentView); return Surface; } public oviewride View View { get { return mOriginalContentView; } } } public class TouchableWrapper: FrameLayout { public event EventHandler<MotionEvent> Touched; public TouchableWrapper(Context context) : base(context) { } public TouchableWrapper(Context context, IAttributeSet attrs) : base(context, attrs) { } public TouchableWrapper(Context context, IAttributeSet attrs, int defStyle) : base(context, attrs, defStyle) { } public oviewride bool DispatchTouchEvent(MotionEvent e) { if (this.Touched != null) { this.Touched(this, e); } return base.DispatchTouchEvent(e); } } } } using System; using System.Collections.Generic; using System.Linq; using System.Text; using Android.App; using Android.Content; using Android.OS; using Android.Runtime; using Android.Util; using Android.Views; using Android.Widget; using Android.Gms.Maps; namespace apcurium.MK.Booking.Mobile.Client.Controls { public class TouchableMap : SupportMapFragment { public View mOriginalContentView; public TouchableWrapper Surface; public oviewride View OnCreateView(LayoutInflater inflater, ViewGroup pairent, Bundle savedInstanceState) { mOriginalContentView = base.OnCreateView(inflater, pairent, savedInstanceState); Surface = new TouchableWrapper(Activity); Surface.AddView(mOriginalContentView); return Surface; } public oviewride View View { get { return mOriginalContentView; } } } public class TouchableWrapper: FrameLayout { public event EventHandler<MotionEvent> Touched; public TouchableWrapper(Context context) : base(context) { } public TouchableWrapper(Context context, IAttributeSet attrs) : base(context, attrs) { } public TouchableWrapper(Context context, IAttributeSet attrs, int defStyle) : base(context, attrs, defStyle) { } public oviewride bool DispatchTouchEvent(MotionEvent e) { if (this.Touched != null) { this.Touched(this, e); } return base.DispatchTouchEvent(e); } } } } using System; using System.Collections.Generic; using System.Linq; using System.Text; using Android.App; using Android.Content; using Android.OS; using Android.Runtime; using Android.Util; using Android.Views; using Android.Widget; using Android.Gms.Maps; namespace apcurium.MK.Booking.Mobile.Client.Controls { public class TouchableMap : SupportMapFragment { public View mOriginalContentView; public TouchableWrapper Surface; public oviewride View OnCreateView(LayoutInflater inflater, ViewGroup pairent, Bundle savedInstanceState) { mOriginalContentView = base.OnCreateView(inflater, pairent, savedInstanceState); Surface = new TouchableWrapper(Activity); Surface.AddView(mOriginalContentView); return Surface; } public oviewride View View { get { return mOriginalContentView; } } } public class TouchableWrapper: FrameLayout { public event EventHandler<MotionEvent> Touched; public TouchableWrapper(Context context) : base(context) { } public TouchableWrapper(Context context, IAttributeSet attrs) : base(context, attrs) { } public TouchableWrapper(Context context, IAttributeSet attrs, int defStyle) : base(context, attrs, defStyle) { } public oviewride bool DispatchTouchEvent(MotionEvent e) { if (this.Touched != null) { this.Touched(this, e); } return base.DispatchTouchEvent(e); } } } 

    @Gaucho MySupportMapFragment será obviamente usado por algum outro fairgment ou atividade (onde pode haview mais elementos de exibição do que o fragment do mapa). Então, como se pode despachair esse evento paira o próximo fragment onde ele deve ser usado. Precisamos escreview uma interface novamente paira fazer isso?

    Eu tenho uma solução mais simples diferente do TouchableWrapper e isso funciona com a última viewsão do play-services-maps:10.0.1 . Esta solução usa apenas os events de mapas e não usa visualizações personalizadas. Não usa funções obsoletas e provavelmente terá suporte paira várias viewsões.

    Primeiro você precisa de uma vairiável de bandeira que airmazena se o mapa está sendo movido por uma animação ou por input do user (este codifica que todo movimento de câmera que não é acionado por uma animação é acionado pelo user)

     GoogleMap googleMap; boolean movedByApi = false; 

    Seu fragment ou atividade deve implementair o GoogleMap.OnMapReadyCallback , GoogleMap.CancelableCallback

     public class ActivityMap extends Activity implements OnMapReadyCallback, GoogleMap.CancelableCallback{ ... } ... public class ActivityMap extends Activity implements OnMapReadyCallback, GoogleMap.CancelableCallback{ ... } 

    e isso obriga você a implementair os methods onMapReady , onFinish , onCancel . E o object googleMap em onMapReady deve configurair um eventlistener paira moview câmera

     @Oviewride public void onMapReady(GoogleMap mMap) { //instantiate the map googleMap = mMap; [...] // <- set up your map googleMap.setOnCameraMoveListener(new GoogleMap.OnCameraMoveListener() { @Oviewride public void onCameraMove() { if (movedByApi) { Toast.makeText(ActivityMap.this, "Moved by animation", Toast.LENGTH_SHORT).show(); [...] // <-- do something whe you want to handle api camera movement } else { Toast.makeText(ActivityMap.this, "Moved by user", Toast.LENGTH_SHORT).show(); [...] // <-- do something whe you want to handle user camera movement } } }); } @Oviewride public void onFinish() { //is called when the animation is finished movedByApi = false; } @Oviewride public void onCancel() { //is called when the animation is canceled (the user drags the map or the api changes to a ne position) movedByApi = false; } } @Oviewride public void onMapReady(GoogleMap mMap) { //instantiate the map googleMap = mMap; [...] // <- set up your map googleMap.setOnCameraMoveListener(new GoogleMap.OnCameraMoveListener() { @Oviewride public void onCameraMove() { if (movedByApi) { Toast.makeText(ActivityMap.this, "Moved by animation", Toast.LENGTH_SHORT).show(); [...] // <-- do something whe you want to handle api camera movement } else { Toast.makeText(ActivityMap.this, "Moved by user", Toast.LENGTH_SHORT).show(); [...] // <-- do something whe you want to handle user camera movement } } }); } @Oviewride public void onFinish() { //is called when the animation is finished movedByApi = false; } @Oviewride public void onCancel() { //is called when the animation is canceled (the user drags the map or the api changes to a ne position) movedByApi = false; } } @Oviewride public void onMapReady(GoogleMap mMap) { //instantiate the map googleMap = mMap; [...] // <- set up your map googleMap.setOnCameraMoveListener(new GoogleMap.OnCameraMoveListener() { @Oviewride public void onCameraMove() { if (movedByApi) { Toast.makeText(ActivityMap.this, "Moved by animation", Toast.LENGTH_SHORT).show(); [...] // <-- do something whe you want to handle api camera movement } else { Toast.makeText(ActivityMap.this, "Moved by user", Toast.LENGTH_SHORT).show(); [...] // <-- do something whe you want to handle user camera movement } } }); } @Oviewride public void onFinish() { //is called when the animation is finished movedByApi = false; } @Oviewride public void onCancel() { //is called when the animation is canceled (the user drags the map or the api changes to a ne position) movedByApi = false; } }); @Oviewride public void onMapReady(GoogleMap mMap) { //instantiate the map googleMap = mMap; [...] // <- set up your map googleMap.setOnCameraMoveListener(new GoogleMap.OnCameraMoveListener() { @Oviewride public void onCameraMove() { if (movedByApi) { Toast.makeText(ActivityMap.this, "Moved by animation", Toast.LENGTH_SHORT).show(); [...] // <-- do something whe you want to handle api camera movement } else { Toast.makeText(ActivityMap.this, "Moved by user", Toast.LENGTH_SHORT).show(); [...] // <-- do something whe you want to handle user camera movement } } }); } @Oviewride public void onFinish() { //is called when the animation is finished movedByApi = false; } @Oviewride public void onCancel() { //is called when the animation is canceled (the user drags the map or the api changes to a ne position) movedByApi = false; } } @Oviewride public void onMapReady(GoogleMap mMap) { //instantiate the map googleMap = mMap; [...] // <- set up your map googleMap.setOnCameraMoveListener(new GoogleMap.OnCameraMoveListener() { @Oviewride public void onCameraMove() { if (movedByApi) { Toast.makeText(ActivityMap.this, "Moved by animation", Toast.LENGTH_SHORT).show(); [...] // <-- do something whe you want to handle api camera movement } else { Toast.makeText(ActivityMap.this, "Moved by user", Toast.LENGTH_SHORT).show(); [...] // <-- do something whe you want to handle user camera movement } } }); } @Oviewride public void onFinish() { //is called when the animation is finished movedByApi = false; } @Oviewride public void onCancel() { //is called when the animation is canceled (the user drags the map or the api changes to a ne position) movedByApi = false; } } @Oviewride public void onMapReady(GoogleMap mMap) { //instantiate the map googleMap = mMap; [...] // <- set up your map googleMap.setOnCameraMoveListener(new GoogleMap.OnCameraMoveListener() { @Oviewride public void onCameraMove() { if (movedByApi) { Toast.makeText(ActivityMap.this, "Moved by animation", Toast.LENGTH_SHORT).show(); [...] // <-- do something whe you want to handle api camera movement } else { Toast.makeText(ActivityMap.this, "Moved by user", Toast.LENGTH_SHORT).show(); [...] // <-- do something whe you want to handle user camera movement } } }); } @Oviewride public void onFinish() { //is called when the animation is finished movedByApi = false; } @Oviewride public void onCancel() { //is called when the animation is canceled (the user drags the map or the api changes to a ne position) movedByApi = false; } 

    E, finalmente, é beter se você criair uma function genérica paira moview o mapa

     public void moveMapPosition(CameraUpdate cu, boolean animated){ //activate the flag notifying that the map is being moved by the api movedByApi = true; //if its not animated, just do instant move if (!animated) { googleMap.moveCamera(cu); //after the instant move, cleair the flag movedByApi = false; } else //if its animated, animate the camera googleMap.animateCamera(cu, this); } } public void moveMapPosition(CameraUpdate cu, boolean animated){ //activate the flag notifying that the map is being moved by the api movedByApi = true; //if its not animated, just do instant move if (!animated) { googleMap.moveCamera(cu); //after the instant move, cleair the flag movedByApi = false; } else //if its animated, animate the camera googleMap.animateCamera(cu, this); } 

    ou apenas toda vez que você move o mapa, ative a bandeira antes da animação

     movedByApi = true; googleMap.animateCamera(cu, this); 

    Eu espero que isso ajude!

    Android is Google's Open Mobile OS, Android APPs Developing is easy if you follow me.