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:
Using java Syntax Highlighting
- @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);
- }.
Parsed in 0.035 seconds, using GeSHi 1.0.8.4
Please tell me what do i do wrong.
Any help is more than welcome


