HI,
Thanks for your reply.. I still could not figure out on how to write in the
ontap method with that canvas opup which is again clickable to a new
activity..
Can u please help me in code level with the same.. Thanks in advance....This
is quite urgent for me and i've been unsuccessful in getting the same .The
code is as below:


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();
   }


}



On Thu, May 6, 2010 at 8:34 AM, TreKing <[email protected]> wrote:

> On Wed, May 5, 2010 at 8:57 PM, karthik k <[email protected]> wrote:
>
>> 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).
>>
>
> A MapView is a ViewGroup like any other -  you can add other views to it at
> any point. Unique to MapView are layout params that let you place views
> based on map coordinates.
>
> It's a simple matter of defining the layout you want to show, inflating it
> on tap, and adding it to the MapView at the correct location.
>
>
> -------------------------------------------------------------------------------------------------
> TreKing - Chicago transit tracking app for Android-powered devices
> http://sites.google.com/site/rezmobileapps/treking
>
> --
> 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
> [email protected]<android-beginners%[email protected]>
> For more options, visit this group at
> http://groups.google.com/group/android-beginners?hl=en
>

-- 
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
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-beginners?hl=en

Reply via email to