Implement any action you need to be triggered on one of the following map events:
Panning
Single click
Double click
Long click
Map rotate
Camera movement
Sample use case: In your app, users invoke one behavior with a single press and another with a
long press.
Use the following code snippets in your app to catch map events. In this example, the action is
simply to display a toast with latitude and longitude on each map event. Of course, you can
implement other cool features instead.
If you want to receive callbacks after a map is clicked, long-clicked, double-clicked or panned,
then you need to define your own TomtomMapCallback listeners:
In this example you will see a Toast with the latitude and longitude of a point that was clicked on
the map, but you can utilize this information in your own manner.
Receive callbacks after the map is clicked.
Receive callbacks after the map is long clicked.
Receive callbacks after the map panning.
Enable and disable gestures
You can disable gestures such as zooming, panning, and rotating in your application by passing
the GesturesConfiguration object to tomtomMap: By default all gestures are enabled.
Disable zooming gesture
1tomtomMap.updateGesturesConfiguration(
2newGesturesConfiguration.Builder()
3.zoomEnabled(false)
4.build()
5);
1tomtomMap.updateGesturesConfiguration(
2 GesturesConfiguration.Builder()
3.zoomEnabled(false)
4.build()
5)
Disable the rotating gesture
1tomtomMap.updateGesturesConfiguration(
2newGesturesConfiguration.Builder()
3.rotationEnabled(false)
4.build()
5);
1tomtomMap.updateGesturesConfiguration(
2 GesturesConfiguration.Builder()
3.rotationEnabled(false)
4.build()
5)
Disable the tilting gesture
1tomtomMap.updateGesturesConfiguration(
2newGesturesConfiguration.Builder()
3.tiltEnabled(false)
4.build()
5);
1tomtomMap.updateGesturesConfiguration(
2 GesturesConfiguration.Builder()
3.tiltEnabled(false)
4.build()
5)
Disable the panning gesture
1tomtomMap.updateGesturesConfiguration(
2newGesturesConfiguration.Builder()
3.panningEnabled(false)
4.build()
5);
1tomtomMap.updateGesturesConfiguration(
2 GesturesConfiguration.Builder()
3.panningEnabled(false)
4.build()
5)
You can turn off more than one gesture by setting up the mask on properties as shown in the
following code snippets:
1tomtomMap.updateGesturesConfiguration(
2newGesturesConfiguration.Builder()
3.rotationEnabled(false)
4.panningEnabled(false)
5.build()
6);
1tomtomMap.updateGesturesConfiguration(
2 GesturesConfiguration.Builder()
3.rotationEnabled(false)
4.panningEnabled(false)
5.build()
6)
If you want to enable gestures, pass the GesturesConfiguration object to the tomtomMap object as
shown in the following code snippets: