Hello,
I have a problem with drawing lines between two points on google map.
I get nullpointerexception on this line of code:
canvas.drawLine(p1.x, p1.y, p2.x, p2.y, paint);
I know this is a very basic thing, but I don't know not much about it
and I really really need your help.
here is were i call this method:
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
linearLayout = (LinearLayout) findViewById(R.id.zoomview);
mapView = (MapView) findViewById(R.id.mapview);
mapView.setBuiltInZoomControls(on);
mapOverlays = mapView.getOverlays();
drawable = this.getResources().getDrawable(R.drawable.circle);
itemizedoverlay = new HelloItemizedOverlay(drawable);
Projection projection = mapView.getProjection();
Double lat1 = 30.342833*1E6, lon1 = -91.719033*1E6;
Double lat2 = -37.5262180*1E6, lon2 = 175.8060710*1E6;
point1 = new GeoPoint(lat1.intValue(), lon1.intValue());
point2 = new GeoPoint(lat2.intValue(), lon2.intValue());
p1 = new Point();
p2 = new Point();
projection.toPixels(point1, p1);
projection.toPixels(point2, p2);
canvas = new Canvas();
canvas.drawLine(p1.x, p1.y, p2.x, p2.y, paint);
}
Any help is more than welcome.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" 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-developers?hl=en
-~----------~----~----~----~------~----~------~--~---