android - I've been busy for a long time finding out how to draw a line between one (GPS) points and one marker on the map in my application. can someone? -


i have different files geolocation , markers :d want draw line... position (using gps) marker inputed in application. if clicked 1 marker choose there line :) thank i'm new please me..

//this locationhelper  public static googlemap getstorelist(googlemap googlemap){          // create marker         markeroptions seveneleven = new markeroptions().position(new latlng(14.616737, 120.982916)).title("7-eleven");         googlemap.addmarker(seveneleven);          markeroptions sevenelevenrecto = new markeroptions().position(new latlng(14.601643, 120.988580)).title("7-eleven recto");         googlemap.addmarker(sevenelevenrecto);          markeroptions newestgroceryencoldstore = new markeroptions().position(new latlng(14.597770, 120.983253)).title("newest grocery , cold store");         googlemap.addmarker(newestgroceryencoldstore);          markeroptions savemorestacruz = new markeroptions().position(new latlng(14.601845, 120.981116)).title("savemore sta cruz");         googlemap.addmarker(savemorestacruz);          markeroptions seventondo = new markeroptions().position(new latlng(14.63059, 120.97355 )).title("7-eleven (pampanga st, tondo, manila)");         googlemap.addmarker(seventondo);          markeroptions seventayuman = new markeroptions().position(new latlng(14.65086, 120.98248 )).title("7-eleven (tayuman road, sta. cruz, manila)");         googlemap.addmarker(seventayuman);          markeroptions ministopm = new markeroptions().position(new latlng(14.64239, 120.98694 )).title("ministop (sampaloc, manila))");         googlemap.addmarker(ministopm);          markeroptions ministopmm = new markeroptions().position(new latlng(14.63657, 120.98505 )).title("vosges convenience store (g/f old free press bldg soler st, quiapo, manila))");         googlemap.addmarker(ministopmm);          markeroptions ministopmp = new markeroptions().position(new latlng(14.60555, 120.98853 )).title("mini stop (padre campa st. sampaloc, manila)");         googlemap.addmarker(ministopmp);          markeroptions savemorestacruz = new markeroptions().position(new latlng(14.57734, 120.99197 )).title("savemore (sta. cruz, manila)");         googlemap.addmarker(savemorestacruz);          markeroptions super8recto = new markeroptions().position(new latlng(14.601971, 120.987858)).title("super 8 recto");         googlemap.addmarker(super8recto);          return googlemap;     }   //this file geolocation in mainactivity. 

if have lat-long of source , destination can use below code.

 private list<latlng> decodepoly(string encoded) {  list<latlng> poly = new arraylist<latlng>(); int index = 0, len = encoded.length(); int lat = 0, lng = 0;  while (index < len) {     int b, shift = 0, result = 0;     {         b = encoded.charat(index++) - 63;         result |= (b & 0x1f) << shift;         shift += 5;     } while (b >= 0x20);     int dlat = ((result & 1) != 0 ? ~(result >> 1) : (result >> 1));     lat += dlat;      shift = 0;     result = 0;     {         b = encoded.charat(index++) - 63;         result |= (b & 0x1f) << shift;         shift += 5;     } while (b >= 0x20);     int dlng = ((result & 1) != 0 ? ~(result >> 1) : (result >> 1));     lng += dlng;      latlng p = new latlng( (((double) lat / 1e5)),              (((double) lng / 1e5) ));     poly.add(p); }    return poly; } 

please refer link detail information.


Comments

Popular posts from this blog

php - Invalid Cofiguration - yii\base\InvalidConfigException - Yii2 -

How to show in django cms breadcrumbs full path? -

ruby on rails - npm error: tunneling socket could not be established, cause=connect ETIMEDOUT -