Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Answers given below :</p> <p>1) Here's a solution that I used :</p> <pre><code>/** Called when the activity is first created. */ private List&lt;Overlay&gt; mapOverlays; private Projection projection; @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(true); mapOverlays = mapView.getOverlays(); projection = mapView.getProjection(); mapOverlays.add(new MyOverlay()); } @Override protected boolean isRouteDisplayed() { return false; } class MyOverlay extends Overlay{ public MyOverlay(){ } public void draw(Canvas canvas, MapView mapv, boolean shadow){ super.draw(canvas, mapv, shadow); Paint mPaint = new Paint(); mPaint.setDither(true); mPaint.setColor(Color.RED); mPaint.setStyle(Paint.Style.FILL_AND_STROKE); mPaint.setStrokeJoin(Paint.Join.ROUND); mPaint.setStrokeCap(Paint.Cap.ROUND); mPaint.setStrokeWidth(2); GeoPoint gP1 = new GeoPoint(19240000,-99120000); GeoPoint gP2 = new GeoPoint(37423157, -122085008); Point p1 = new Point(); Point p2 = new Point(); Path path = new Path(); Projection projection.toPixels(gP1, p1); projection.toPixels(gP2, p2); path.moveTo(p2.x, p2.y); path.lineTo(p1.x,p1.y); canvas.drawPath(path, mPaint); } </code></pre> <p>courtesy: <a href="https://stackoverflow.com/questions/2176397/drawing-a-line-path-on-google-maps">Drawing a line/path on Google Maps</a></p> <p>2) Here's what worked for me :</p> <pre><code>createMarkers() { for(elem:bigList) { GeoPoint geoPoint = new GeoPoint((int)(elem.getLat()*1000000), (int) (elem.getLon()*1000000)); OverlayItem overlayItem = new OverlayItem(geoPoint, elem.getName(), elem.getData()); itemizedOverlay.addOverlay(overlayItem); } itemizedOverlay.populateNow(); mapOverlays.add(itemizedOverlay); //outside of for loop } </code></pre> <p>and in MyOverlay: </p> <pre><code>public void addOverlay(OverlayItem overlay) { m_overlays.add(overlay); } public void populateNow() { populate(); } </code></pre> <p>courtesy: stackoverflow.com unknown link</p> <p>3) The best way is to use a timer class. A very detailed description of the timer class and how to use it is given at this link :</p> <p><a href="http://life.csu.edu.au/java-tut/essential/threads/timer.html" rel="nofollow noreferrer">http://life.csu.edu.au/java-tut/essential/threads/timer.html</a></p> <p>4) I used this code :</p> <pre><code>if(!mapOverlays.isEmpty()) { mapOverlays.clear(); mapView.invalidate(); } </code></pre> <p>Hope these answers help atleast one other person. Thanks.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload