0

I am developing an android app in which i want to mark some places and then trace path b/w them. like if I start my journey from A and mark it, then go to Band mark that, then C and at last when I reached my final destination. then i want to trace the path from A-B-C.... I had tried many and found that i can use url intent to do that by passing lat-long dynamically, but i want to mark random places at runtime..... now i am using this.

    String uri = "http://maps.google.com/maps?f=d&source=s_d&saddr=" + 30.7353 +","+76.7911+"&daddr="+12.9833+","+ 77.5833+"+to:"+22.5697+","+88.3697;
    Intent intent = new Intent(android.content.Intent.ACTION_VIEW, Uri.parse(uri));
    intent.setClassName("com.google.android.apps.maps", "com.google.android.maps.MapsActivity");  
    startActivity(intent); 

please help me out. thank.

jatyan
  • 41
  • 1
  • 3

1 Answers1

0

If i understand you correctly, while you are using the map you want to set a marker and then to set another one and to create a poly-line between those markers:

1. to set a marker by clicking on the map you need to override the onMapClick method and set your activity as a OnMapClickListener. there create a marker for you click and get it's coordination.

2. Now when you done that and create 2 marker you can head to this post to understand how to create a polyline between those 2 markers and the one's that follows:enter link description here

Community
  • 1
  • 1
Emil Adz
  • 40,709
  • 36
  • 140
  • 187
  • but my problm is that i want that points to be user-defined, that link works on two dynamically set points, and i want to get points from user and that can be of any no. – jatyan Mar 04 '13 at 07:22
  • @jatyan, please read my answer again, if you want your user to create his own marker on the map (by clicking on it or by long clicking on it) you need to let your map activity implement OnMapClicKListener or OnMapLongClicKListener... and then override the the OnMapClick method or OnMapLongClick method to determine the click coordinates, set a new marker and connect it with the privious one by a polyline with the code you already have. – Emil Adz Mar 04 '13 at 08:19