0

I want to pass an arraylist of values from mapactivity to the overlay class:

 MyOverlay dataOverlay = new MyOverlay(loc);

In the overlay class a constructor is created:

public class MyOverlay {

public MyOverlay(List<Double> loc) {
    // TODO Auto-generated constructor stub
    GeoPoint point = new GeoPoint((int)(location.get(1)*1E6) , (int)(location.get(0)*1E6));
}
public void draw(Canvas canvas, MapView mapView, boolean shadow, GeoPoint mp){

     super.draw(canvas, mapView, shadow, mp);
}

}

From this loc arraylist I want to draw one point and mnay polylines from the rest of the values. This geopoint cannot pass to the draw class.

What is the next step after passing and how can I access this loc in the draw method?

chembrad
  • 887
  • 3
  • 19
  • 33
Sarah Salar
  • 193
  • 1
  • 3
  • 14
  • this is my code for drawing point on google map mapctivity class proj = mapView.getProjection(); mapOverlays = mapView.getOverlays(); MyOverlay dataOverlay = new MyOverlay(location); mapOverlays.clear(); mapOverlays.add(dataOverlay); – Sarah Salar Sep 19 '12 at 16:01
  • and overlay class public MyOverlay(List location) { // TODO Auto-generated constructor stub super(); this.location = location; } – Sarah Salar Sep 19 '12 at 16:05
  • public void draw(Canvas canvas, MapView mapView, boolean shadow){ super.draw(canvas, mapView, shadow); GeoPoint mp = new GeoPoint((int)(location.get(1)*1E6) , (int)(location.get(0)*1E6)); Point p1 = new Point(); mapView.getProjection().toPixels(mp, p1); canvas.drawBitmap(BitmapFactory.decodeResource(getResources(), R.drawable.markerblue),p1.x, p1.y , null); } private Resources getResources() { // TODO Auto-generated method stub return null; } } but this is not working my application stops forcefully – Sarah Salar Sep 19 '12 at 16:05
  • this is my code to draw a path from list of points it dosenot work same error application stops forcefully – Sarah Salar Sep 19 '12 at 19:48
  • public void draw(Canvas canvas, MapView mapView , boolean shadow) { super.draw(canvas, mapView, shadow); Path path = new Path(); Point p1 = new Point(); Point startPoint = null, endPoint = null; Projection projection = mapView.getProjection(); for(int i = 3; i – Sarah Salar Sep 19 '12 at 19:49
  • else { //endPoint = p1; if(i==location.size()-1) endPoint = p1; path.lineTo(p1.x, p1.y); } } Paint paint = new Paint(); paint.setAntiAlias(true); paint.setColor(Color.RED); paint.setStyle(Paint.Style.STROKE); paint.setStrokeWidth(5); paint.setAlpha(90); if (!path.isEmpty()) canvas.drawPath(path, paint); } – Sarah Salar Sep 19 '12 at 19:50
  • this is my mapactivity class in which i draw a point List mapOverlays = mapView.getOverlays(); Drawable drawable = this.getResources().getDrawable(R.drawable.markerblue); MyItemizedOverlay drawit = new MyItemizedOverlay(drawable, location); GeoPoint mp = new GeoPoint((int)(location.get(1)*1E6) , (int)(location.get(0)*1E6)); OverlayItem overlayitem = new OverlayItem(mp, "Meeting Point", null); // drawit.addOverlay(overlayitem); mapOverlays.add(drawit); – Sarah Salar Sep 19 '12 at 20:21
  • hello forum i have added two class one is itemizedoverlay and one overlay itemizedoverlay is for drawing point and overlay is for drawing route but my route cannot displayed my application stops i have uploaded my code – Sarah Salar Sep 19 '12 at 20:46
  • draw method is not called i added @override also but same error it does not go into draw method – Sarah Salar Sep 19 '12 at 22:06

0 Answers0