Reputation: 71
I want to draw my Path on GoogleMap in android..as i move Forword a polyline should be drawn...i read some Tutorials about google maps and json parser but i that case we only draw path from start to destinition...I Also Read a tutorial that draws Overlay on MapView..but i want to draw it on GooglMap Class...the code for MapView OverLay is as follow but it didn't work with GooglMap
package com.example.PublicSafety;
import java.util.ArrayList;
import java.util.List;
import com.google.android.maps.Overlay;
import android.graphics.Color;
import android.graphics.Paint;
import android.location.Location;
public class RouteOverlay extends Overlay{
private List<Location> locations;
private Paint pathPaint;
private Paint postionPaint;
public RouteOverlay() {
pathPaint = new Paint();
pathPaint.setAntiAlias(true);
pathPaint.setColor(Color.RED);
pathPaint.setStyle(Paint.Style.STROKE);
pathPaint.setStrokeWidth(5);
locations = new ArrayList<Location>();
postionPaint = new Paint();
postionPaint.setAntiAlias(true);
postionPaint.setStyle(Paint.Style.FILL);
}
}
Upvotes: 0
Views: 138
Reputation: 898
Refer these links (And Try To Search Before Posting Questions Because The Are Already Having Answers)
Answer : Draw path between two points using Google Maps Android API v2
how to draw path between 2 points on google map
http://javapapers.com/android/draw-path-on-google-maps-android-api/
http://iamvijayakumar.blogspot.in/2013/04/android-draw-route-between-two-geo.html
Upvotes: 1