--- android/TrainInfo/src/dk/thoerup/traininfo/stationmap/StationOverlay.java 2009/09/30 13:32:20 368 +++ android/TrainInfo/src/dk/thoerup/traininfo/stationmap/StationOverlay.java 2009/09/30 16:40:48 369 @@ -3,8 +3,10 @@ import java.util.ArrayList; import java.util.List; +import android.content.Context; import android.graphics.drawable.Drawable; import android.util.Log; +import android.widget.Toast; import com.google.android.maps.ItemizedOverlay; import com.google.android.maps.OverlayItem; @@ -12,27 +14,37 @@ public class StationOverlay extends ItemizedOverlay { private ArrayList mOverlays = new ArrayList(); - public StationOverlay(Drawable defaultMarker) { + Context context; + + + public StationOverlay(Drawable defaultMarker, Context ctx) { super(boundCenterBottom(defaultMarker)); + context = ctx; } - - public void addUserLocation(GeoPair location) { - OverlayItem item = new OverlayItem(location.toGeopoint(), "You", ""); + /* + public void addUserLocation(GeoPair location, Drawable icon) { + OverlayItem item = new OverlayItem(location.toGeopoint(), "You", "You"); + item.setMarker(icon); + mOverlays.add(item); populate(); - } + }*/ @Override protected boolean onTap(int index) { - Log.e("OnTap", "INDEX=" + index); - return super.onTap(index); + OverlayItem item = mOverlays.get(index); + + + Toast.makeText(context, item.getSnippet(), Toast.LENGTH_SHORT).show(); + + Log.e("OnTap", "OnTab:"+index); + return true; } public void addStations( List stations ) { for (GeoPair gp : stations) { - OverlayItem item = new OverlayItem(gp.toGeopoint(), "Station", ""); - + OverlayItem item = new OverlayItem(gp.toGeopoint(), "Station", gp.getDescription()); mOverlays.add(item); } populate();