Hi,
I am using Android 2.0.1 with Google APIs. I wrote a simple app using
ItemizedOverlay. here is the code snippet:
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
linearLayout = (LinearLayout)findViewById(R.id.zoomview);
mapView = (MapView)findViewById(R.id.mapview);
//mapView.setSatellite(true);
mapView.setStreetView(true);
mapView.setBuiltInZoomControls(true);
drawable = this.getResources().getDrawable(R.drawable.icon);
itemizedOverlay = new HelloItemizedOverlay(drawable);
Double lat = 37.2591264 * 1E6;
Double ln = -121.968505 * 1E6;
GeoPoint point = new GeoPoint(lat.intValue(),ln.intValue() );
OverlayItem overlayitem2 = new OverlayItem(point, "", "");
itemizedOverlay.addOverlay(overlayitem2);
mapOverlays.add(itemizedOverlay);
ItemizedOverlay class:-
public class HelloItemizedOverlay extends ItemizedOverlay {
//Context ma;
private ArrayList<OverlayItem> mOverlays = new ArrayList<OverlayItem>
();
public HelloItemizedOverlay(Drawable defaultMarker) {
super(boundCenterBottom(defaultMarker));
// TODO Auto-generated constructor stub
}
public void addOverlay(OverlayItem overlay) {
mOverlays.add(overlay);
populate();
}
@Override
protected OverlayItem createItem(int i) {
// TODO Auto-generated method stub
return mOverlays.get(i);
}
@Override
public int size() {
// TODO Auto-generated method stub
return mOverlays.size();
}
}
when I run the above code, i do not get the correct location on the
map . it points to location Tulsa in Okhlama state while I was
entering the coordinates for Los Gatos , CA.
Even the icon is missing.
However when i use the Map Controller and call animateTo(point) , i
get the correct location.
I am not sure what is wrong?.
would appreciate any pointers here..
--
You received this message because you are subscribed to the Google
Groups "Android Beginners" 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-beginners?hl=en