Your coding is fine AFAIK... but can u be more specific... i mean wat
is the logged error u r getting...
sometimes i have seen that just clicking on the map or invalidating
the map results in the display of the pin...
try shifting the map a little... if it doesnt work, pass me the error
generated in the logs...

regards,

P.S. - My names "Vadid" dude...

On Mar 5, 12:44 am, yodaa <[email protected]> wrote:
> @Vavid
>
> Yep, you're absolutely right about the constructor. The relevent
> Context wasn't passed as a  parameter to new HelloItemized objet.
> Something is not clear to me in this tutorial: what is the Context I
> should pass to the HelloItemized objet? Tutorial 
> URL:http://developer.android.com/resources/tutorials/views/hello-mapview....
>
> I tried the following (but this did nothing and my android marker has
> disappeared...):
>
> 1 ) File HelloGoogleMaps.java:
> -------------------------------------------------
> package com.tests;
>
> import java.util.List;
>
> import android.graphics.drawable.Drawable;
> import android.os.Bundle;
> import com.google.android.maps.GeoPoint;
> import com.google.android.maps.MapActivity;
> import com.google.android.maps.MapView;
> import com.google.android.maps.Overlay;
> import com.google.android.maps.OverlayItem;
>
> public class HelloGoogleMaps extends MapActivity
> {
>     /** 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);
>
>         List<Overlay> mapOverlays = mapView.getOverlays();
>         Drawable drawable =
> this.getResources().getDrawable(R.drawable.androidmarker);
>         HelloItemizedOverlay itemizedoverlay = new
> HelloItemizedOverlay(drawable,this);
>         GeoPoint point = new GeoPoint(19240000,-99120000);
>         OverlayItem overlayitem = new OverlayItem(point, "Hola,
> Mundo!", "I'm in Mexico City!");
>
>         itemizedoverlay.addOverlay(overlayitem);
>         mapOverlays.add(itemizedoverlay);
>     }
>     @Override
>     protected boolean isRouteDisplayed()
>     {
>         return false;
>     }
>
> }
>
> 2 ) File : HelloItemizedOverlay.java :
> ----------------------------------------------------
> package com.tests;
>
> import java.util.ArrayList;
> import android.app.AlertDialog;
> import android.app.AlertDialog.Builder;
> import android.content.Context;
> import android.graphics.drawable.Drawable;
> import com.google.android.maps.ItemizedOverlay;
> import com.google.android.maps.OverlayItem;
>
> public class HelloItemizedOverlay extends ItemizedOverlay
> {
>         private ArrayList<OverlayItem> mOverlays = new
> ArrayList<OverlayItem>();
>         private Context mContext;
>
>         public HelloItemizedOverlay(Drawable defaultMarker, Context context)
>         {
>                   super(defaultMarker);
>                   mContext = context;
>         }
>
>         public void addOverlay(OverlayItem overlay)
>         {
>             mOverlays.add(overlay);
>             populate();
>         }
>         @Override
>         protected OverlayItem createItem(int i)
>         {
>           return mOverlays.get(i);
>         }
>         @Override
>         public int size()
>         {
>           return mOverlays.size();
>         }
>         @Override
>         protected boolean onTap(int index)
>         {
>           OverlayItem item = mOverlays.get(index);
>           AlertDialog.Builder dialog = new AlertDialog.Builder(mContext);
>           dialog.setTitle(item.getTitle());
>           dialog.setMessage(item.getSnippet());
>           dialog.show();
>           return true;
>         }
>
> }
>
> Help would be appreciated...
>
> On 26 fév, 05:52, Vadid Valiulla <[email protected]> wrote:
>
> > Actually your problem is that the Dialog is not getting the correct
> > context... Coz the constructor u initialized doesnt have the context
> > passed to it... Check that and i suppose your problem should get
> > solved...
>
> > sorry 4 sending another message i forgot to mention the reason i gave
> > the re-defined constructor...
>
> > Take care...

-- 
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