have ben stuck with a problem. It is about a markers on the overlay on a map and the ontap method. I'm unable to implement the methods inside the onTap() so that upon i click the androidmarker icon on the map, it tells me some cavvas popout layout being transparent with some text(substantially, even that canvas layout is clickable and takes to another activity). i have copy pasted the code below:
I hope to find some solution from you. Thanks in advance I'm using the sample program given in the Google Android Website http://developer.android.com/resources/tutorials/views/hello-mapview.html and i want to extended it to the next level. Urgent help needed. Thanks in advance.. Let me know if more infomration is requirred //HelloGoogleMaps.java import java.util.List; import com.google.android.maps.GeoPoint; import com.google.android.maps.MapActivity; import com.google.android.maps.MapController; import com.google.android.maps.MapView; import com.google.android.maps.Overlay; import com.google.android.maps.OverlayItem; import android.app.Activity; import android.graphics.drawable.Drawable; import android.os.Bundle; public class HelloGoogleMaps extends MapActivity { MapController mapController; /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); MapView mapView = (MapView) findViewById(R.id.mapview); mapView.setBuiltInZoomControls(true); mapController = mapView.getController(); mapController.setZoom(2); List<Overlay> mapOverlays = mapView.getOverlays(); Drawable drawable = this.getResources().getDrawable(R.drawable.androidmarker); HelloItemizedOverlay itemizedoverlay = new HelloItemizedOverlay(drawable,this); GeoPoint point = new GeoPoint(45005000,-93228900); OverlayItem overlayitem = new OverlayItem(point, "Hola, Mundo!", "I'm in Mexico City!"); GeoPoint point2 = new GeoPoint(35410000, 139460000); OverlayItem overlayitem2 = new OverlayItem(point2, "wow", "this is tokyo"); itemizedoverlay.addOverlay(overlayitem); itemizedoverlay.addOverlay(overlayitem2); mapOverlays.add(itemizedoverlay); } @Override protected boolean isRouteDisplayed() { return false; } } // HelloItemizedOverlay.java import java.util.ArrayList; import android.app.AlertDialog; import android.content.Context; import android.graphics.drawable.Drawable; import android.view.View; import android.widget.Toast; import com.google.android.maps.ItemizedOverlay; import com.google.android.maps.OverlayItem; public class HelloItemizedOverlay extends ItemizedOverlay { private ArrayList<OverlayItem> mOverlays = new ArrayList<OverlayItem>(); Context mContext ; public HelloItemizedOverlay(Drawable defaultMarker) { super(boundCenterBottom(defaultMarker)); // TODO Auto-generated constructor stub } public HelloItemizedOverlay(Drawable defaultMarker, Context context) { super(boundCenterBottom(defaultMarker)); mContext = context; } @Override protected boolean onTap(int index) { OverlayItem item = mOverlays.get(index); /*// working below code, just replace */ AlertDialog.Builder dialog = new AlertDialog.Builder(mContext); dialog.setTitle(item.getTitle()); dialog.setMessage(item.getSnippet()); dialog.show(); // I need to show another dialog opening up on tapping the above dialog. Need help here: return true; } @Override public int size() { return mOverlays.size(); } @Override protected OverlayItem createItem(int i) { return mOverlays.get(i); } public void addOverlay(OverlayItem overlay) { mOverlays.add(overlay); populate(); } } -- You received this message because you are subscribed to the Google Groups "Android Beginners" group. NEW! Try asking and tagging your question on Stack Overflow at http://stackoverflow.com/questions/tagged/android To unsubscribe from this group, send email to android-beginners+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en