Android: Map Overlay Labels
<p>I am building a MapView and I want my custom overlay items to display the name of the location they are marking when the user taps them, like the Android Maps app.</p>

<p>I setup the onTap listener and the floating TextView to hold the location name.  I still need to set it up so that it redraws the label when the user moves the map, etc.</p>

<p>Anyway, I am wondering if I am reinventing the wheel here.  Is there a built-in method I am unaware of?  I would think that most implementations of MapView have labels.</p>

<p>For reference, my implementation so far:</p>

<p>in map xml:</p>

<pre><code>&lt;LinearLayout android:id="@+id/mapBubbleWrap"
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:layout_alignParentTop="true"&gt;
    &lt;TextView android:id="@+id/mapBubble" 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:visibility="gone" 
        android:background="#ffffff" 
        android:textColor="#ff0000"/&gt;
&lt;/LinearLayout&gt;
</code></pre>

<p>in my extended ItemizedOverlay:</p>

<pre><code>public boolean onTap(int index) {

    this.setFocus( mOverlays.get(index) );      
    return true;
}
</code></pre>

<p>in my Activity onFocus:</p>

<pre><code>public void onFocusChanged( ItemizedOverlay overlay, OverlayItem item ) {
    if( item != null) {
        mapBubble.setText(item.getTitle());
        Point newPoint = mapView.getProjection().toPixels(item.getPoint(), null);
        mapBubbleWrap.setPadding(newPoint.x, newPoint.y-10, 0, 0);
        mapBubble.setVisibility(View.VISIBLE);
    }
}
</code></pre>
