Android MapView Balloons
This project provides an easy way to annotate map overlay items with a simple information balloon when using the Android Maps external library (
com.google.android.maps). It consists of
BalloonOverlayView, a view representing the balloon that is displayed over your
BalloonItemizedOverlay, an abstract extension of
The presentation of the balloons was mostly reverse engineered from Google's Places Directory application.
Create a subclass of
BalloonItemizedOverlay in the same way you would do for the base
ItemizedOverlay class. Rather than overriding
onTap() (which is already implemented and final in the subclass to invoke the balloon view display for each item tap), you override
onBalloonTap() to handle a screen tap event on the balloon itself.
The data displayed in each balloon is mapped to the title and snippet arguments you provide to the constructor of each
The repository contains a working sample application project which fully demonstrates its usage.
As of version 1.1, android-mapviewballoons is an Android Library project. Refer to 'Referencing a library project from an application' in this document for instructions on how to include it in your own Android project. Ensure you have the latest Android SDK, tools and Eclipse plugin installed.
To install the library and sample project in Eclipse:
- Select File, Import, Existing projects into workspace...
- Select the root folder where you cloned/downloaded the repository to import both projects.
- Use Project - Clean if there are any errors.
- Custom balloon layouts and data mappings
- Long press support
- Trackball support (not tested)
- Focus events (not tested)
The code in this project is licensed under the Apache Software License 2.0.
Copyright (c) 2010 readyState Software Ltd.