Hi Felix :
In fact this code I am writing for a tutorial to be published soon in
a french Android web site : http://pointgphone.com
First you need to code a listener :
ItemizedOverlay.OnFocusChangeListener FOCUS_LISTENER = new
ItemizedOverlay.OnFocusChangeListener() {
public void onFocusChanged(ItemizedOverlay overlay, OverlayItem
newFocus) {
if (newFocus != null) {
Log.e("MapViewDemo", "MapViewDemo ChangeFocus "
+ newFocus.getTitle());
}
MapViewDemo.this.selectedSearchText = newFocus;
}
};
where MapViewDemo is the MapView.
Then you must affect it to the ItemizedOverlay of your MapView using
setOnFocusChangeListener
myItemizedOverlay.setOnFocusChangeListener(FOCUS_LISTENER);
Last you can use MapViewDemo.this.selectedSearchText in the draw
method of the Overlay for exemple (code inside draw method :
if (MapViewDemo.this.selectedSearchText != null) {
GeoPoint geoPoint = MapViewDemo.this.selectedSearchText.getPoint();
Point point = new Point();
myprojection.toPixels(geoPoint, point);
drawInfoWindow(point);
}
Where drawInfoWindow can be a method to display some info about the
selected item
Hope this help
Andre
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---