Join David Gassner for an in-depth discussion in this video Adding a map fragment to an activity, part of Building Mobile Apps with Google Maps Android API v2.
In its current state, the tour finding app…uses fragments to display a tour detail screen.…When you touch an item and go into the detail screen,…you're seeing a fragment that's displaying at the top of the screen.…And because there's nothing below it, it'll expand as…much as it needs to display the available text.…To display a map, I'm going to add…another fragment to the existing layout for this screen.…I'm working in a version of the project now called TourFinderDisplayMap.…
This is the starting point, and I'll go to the…resources folder, to layout, and I'll open the layout file activity_tour_detail.xml.…This is the layout file that's being seen right now.…It's displaying a fragment called…tourDetailFragHeader, and that's this class, TourDetailHeaderFragment.…And in this class, I'm opening…this layout file, fragment_tour_detail.…And this is where you're seeing the title of the tour,…the price, and the scrolling text view for the description.…
Now, my job is to add a map at the bottom of that screen.…So I'll go back to the tour detail and I'm going to add another fragment right here.…
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?