Join David Gassner for an in-depth discussion in this video Handling marker events, part of Building Mobile Apps with Google Maps Android API v2.
The Google Maps API lets you listen for, and handle a variety of events.…Some of these events are generated by the…map itself, and some by markers on the map.…I'll show you one of each.…I'm working in the version of the project called, Map and Marker events.…And I'll start in the main activity class.…I'll go to the initMap method where I…previously added code to create a custom info window.…And…I'll add some more code in this location.…I'm going to shrink down the code that's creating the info window right here.…
And then I'll click right after that code…and add some new code to listen for events.…To listen for and handle an event, call a method of the map object.…They all start with the words setOn.…So, I'll start with mMap.setOn, and press Ctrl+Space.…Here's a list of the events.…The CameraChange event occurs when the point of…view, or position of the camera has changed.…There are click events for the info window and a long…click event for the map and a drag event for the marker.…
I'm going to create an event listener for the map's long click.…
Note: An Android device with Android 3.0 (Honeycomb) or higher, and that has Google Play Store installed, is required to use the course exercises. (Kindle Fire and Nook devices do not qualify.) Finished mapping apps can be deployed on Android 2.2 (Froyo) or later.
- Setting up the developer tools
- Adding required permissions
- Getting a Google Maps API key
- Importing and linking the Google Play services
- Setting a map's initial state
- Geocoding an address
- Getting the current location programmatically
- Adding map markers
- Handling marker events
- Drawing lines, polygons, and circles
- Adding maps to existing apps
Skill Level Intermediate
Q: In the Chapter 2 movie "Checking the device for the Google Play services APK," when I create my first Google Maps app, the app crashes when I call the custom method servicesOK(). The error in LogCat starts with: "java.lang.IllegalStateException: The meta-data tag in your app's AndroidManifest.xml does not have the right value." How do I fix this?